In article <3ae7cf31-e00c-447a-b6bf-0ed8a99f8...@securityevaluators.com>, Charles Miller <cmil...@securityevaluators.com> wrote: > So I was hoping to figure out how to do that AppleScript line locally, > and then try to do it remotely as well. The real AppleScript I wish > to run in py-appscript is: > > set remoteMachine to "eppc://user:p...@192.168.1.3" > set remoteFinder to application "Finder" of machine remoteMachine > using terms from application "Finder" > tell remoteFinder > open application file id "com.apple.Preview" > end tell > end using terms from > > But I figured I'd start easier and just try to launch a local app with > Finder. Any ideas on how to do the original question (or even better > the above) using py-appscript? Thanks a million.
After some experimenting, I was able to use a remote Finder to either just launch Preview or open a document and launch Preview. Here's what worked: >>> from appscript import * >>> remote_finder = app(url='eppc://user:p...@hostname/Finder') >>> # launch Preview >>> remote_finder.startup_disk.folders["Applications"].application_files[ 'Preview'].open() >>> # alternatively, open document with default application, >>> # launching if necessary >>> remote_finder.startup_disk.folders['Developer'].files[ 'About Xcode Tools.pdf'].open() I was able to launch by bundle id locally: >>> local_finder = app('Finder') >>> local_finder.startup_disk.folders["Applications"].application_files[ its.id == "com.apple.Preview"].open() but remote references failed with: OSERROR: -1731 MESSAGE: Unknown object type. I'm sure HAS can explain what needs to be done to make such something like that work remotely; perhaps you have to construct lower-level references manually. On the other hand, perhaps you don't really need to use the bundle id if the application name is good enough. -- Ned Deily, n...@acm.org _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig