[Pythonmac-SIG] open program via a protocol (eg. myapp:command)
Brendan Simon (eTRIX)
Brendan.Simon at eTRIX.com.au
Sat Jul 11 05:35:57 CEST 2009
Brendan Simon (eTRIX) wrote:
>> I've no idea if there's anything you need to watch for when Apple events
>> in a wxPython-based application, so you might need to do a bit of
>> research on that front. The basic code for handling a GetURL event
>> should go something like this:
>>
>> from Carbon import AE
>> from Carbon.AppleEvents import *
>>
>>
>> def geturl(requestevent, replyevent): # event handler
>> desc = requestevent.AEGetParamDesc(keyDirectObject, typeUTF8Text)
>> url = desc.data.decode('utf8')
>> # do stuff with URL here...
>>
>> AE.AEInstallEventHandler(kAEInternetSuite, kAEISGetURL, __geturl)
>>
>> Studying the argvemulation.py module's implementation may also be
>> informative.
>
> I had a look at argv_emulation.py and it seems to have most of this
> stuff already. It handles OpenApplication and OpenDocuments Apple
> Events. Guess the 'proper' thing to do would be to extend
> argv_emulation.py to handle the IsGetURL event as described above.
>
> I will give it a go and post the results.
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 ??
Thanks, Brendan.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Brendan_Simon.vcf
Type: text/x-vcard
Size: 267 bytes
Desc: not available
URL: <http://mail.python.org/pipermail/pythonmac-sig/attachments/20090711/ba305508/attachment-0001.vcf>
More information about the Pythonmac-SIG
mailing list