Hello, On Fri, Jul 10, 2009 at 8:45 AM, Brendan Simon (eTRIX)<brendan.si...@etrix.com.au> wrote: > has wrote: >> Brendan Simon (eTRIX) wrote: >> >>> I have an OS X python program that is invoked via a uri on a webpage -- >>> eg. "myapp:command" >>> >>> The app is invoked fine (via the plist), but I can't seem to extract the >>> "command" from the system args. sys.argv contains the name of the >>> application and some other values. >>> example: >>> sys.argv[0] = 'myapp >>> sys.argv[1] = '-psn_0_22123800' >>> >>> >>> How can I my program read the _uri_ that caused the program to be >>> invoked. >> >> You need to install an Apple event handler that responds to the GetURL >> event. Various ways you can do that, depending on whether your Python >> application is Carbon or Cocoa based, has an event loop or runs in batch >> mode, uses argvemulation, etc. For more specific advice, provide more >> details. > > I'm using wxPython.
The wx.App object has some builtin method for handling some common apple events. I would have to check the wxWidgets source to remember exactly which event it responds to but you might want to try and override the following method in your App object class. def MacOpenFile(self, filename) IIRC it will be called with the path of the file that is sent to the app for getURL events. If not you need a c extension to add an additional apple event handler to your wxApp object. This is actually quite easy to do, but I think that the above should do what your looking for. Cody _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig