[Pythonmac-SIG] open program via a protocol (eg. myapp:command)

Cody Precord codyprecord at gmail.com
Sat Jul 11 05:55:56 CEST 2009


Hello,

On Jul 10, 2009, at 10:35 PM, Brendan Simon (eTRIX) wrote:

> Brendan Simon (eTRIX) wrote:
>>>
>
> I registered the __geturl() event handler but it never gets called.
>
> How can I determine if the events are being sent to MyApp ??
> I tried:
>  $ export AEDebugSends=1; export AEDebugReceives=1
>  $ open myapp:xyz
>
>
> Obviously some event is causing MyApp to open when I type "open
> myapp:xyz", but does that actually mean MyApp will receive the event  
> or
> just some internal framework that causes the application to be  
> launched ??

Did you see my previous reply (I see it in the archives but not in  
your replies)? Here it is again.

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 (see examples in wxPython wiki), but I think that the  
above should do what your
looking for.


Cody


More information about the Pythonmac-SIG mailing list