[Pythonmac-SIG] Opening an app from another app under different OS X versions

Dethe Elza delza at livingcode.org
Wed Jan 24 18:44:15 CET 2007


As Kevin said, you may only need the full path to your app.  It's  
remotely possible you would need the full path to open as well (/usr/ 
bin/open).  Full paths are finicky though, and you will need to know  
where your application is installed, if the help application is in  
the app bundle, for instance.  Also, paths are different on  
internationalized versions of OS X.

The right way is probably to use PyObjC and the NSWorkspace object:

from AppKit import NSWorkspace
NSWorkspace.sharedWorkspace.launchApplication_('MyApp')

For more on Workspace services, there is this article: file:/// 
Developer/ADC%20Reference%20Library/documentation/Cocoa/Conceptual/ 
Workspace/index.html

Also, when you're launching an app with open, you don't need the -a  
flag, but without it you do need the path to the application.

--Dethe


You need to lay out the user interface components visually, by hand,  
with total control over where they go. Automated LayoutManagers don’t  
cut it. A corollary of this is that you can’t move a UI layout from  
one platform to another and have the computer make everything fit.  
Computers don’t lay out interfaces by themselves any better than they  
can translate French to English by themselves. -- Jens Alfke





More information about the Pythonmac-SIG mailing list