[Pythonmac-SIG] Using Finder to open app by id

Ned Deily nad at acm.org
Sat Aug 22 08:55:08 CEST 2009


In article 
<A24DFB64-8A67-4FE6-88E9-A26A2A14DD17 at securityevaluators.com>,
 Charles Miller <cmiller at securityevaluators.com> wrote:
> How can you run the following Applescript in py-appscript?  I've tried  
> everything I can think of.
> 
> tell application "Finder" to open application file id  
> "com.apple.Preview"
> 
> Obviously, I just want to launch Preview from within py-appscript.  I  
> really want to do this in py-appscript as opposed to just popen/system  
> or something because I'd like to eventually do it remotely (without  
> ssh) so I can run Preview remotely and operate on the GUI remotely  
> using applescript.

You don't need to involve the Finder:

>>> from appscript import *
>>> preview = app(id='com.apple.Preview')
>>> preview.run()
>>> preview.open('/Developer/About Xcode Tools.pdf')

http://appscript.sourceforge.net/py-appscript/doc/appscript-manual/07_app
licationobjects.html

-- 
 Ned Deily,
 nad at acm.org



More information about the Pythonmac-SIG mailing list