On 15 Mar, 18:05, Mark Carter <[EMAIL PROTECTED]> wrote: > The sorts of things I want to do are: > * copy the directory of Finder to the clipboard > * add a new file to Finder's directory. > * find out the size of a directory > * open a file with Aquamacs, regardless of file type,
If you want to control desktop applications directly, that generally means using Apple event IPC. The most popular language for application scripting is traditionally AppleScript, but Apple event bridges exist for other languages as well. The best of these is appscript; see my sig for links. Some Finder scripting examples: #!/usr/bin/python from appscript import * from osax import * finder = app('Finder') standardadditions = ScriptingAddition() folderref = finder.Finder_windows[1].target # set clipboard to path to front window's folder path = folderref.get(resulttype=k.alias).path standardadditions.set_the_clipboard_to(path) # make new empty file in front window's folder finder.make(new=k.file, at=folderref.get()) # get size of front window's folder # (note: this may return k.missing_value when first run # as Finder is sluggish at calculating folder sizes) print folderref.size.get() # open selected items in TextEdit selecteditems = finder.selection.get() finder.open(selecteditems, using=app.application_files.ID('com.apple.textedit')) HTH has -- Control AppleScriptable applications from Python, Ruby and ObjC: http://appscript.sourceforge.net -- http://mail.python.org/mailman/listinfo/python-list