Re: Custom URL Handling
Re: Custom URL Handling
- Subject: Re: Custom URL Handling
- From: Jacob Bandes-Storch <email@hidden>
- Date: Sat, 9 Aug 2008 16:50:03 -0700
It doesn't seem to make sense to use the script suite stuff to receive
the URL event.. shouldn't it be used for scripting only? Or am I
mistaken?
On Aug 9, 2008, at 3:03 PM, Uli Kusterer wrote:
I see some implementations use -[NSAppleEventManager
setEventHandler:andSelector:forEventClass:andEventID:]; with
kInternetEventClass and kAEGetURL, and they implement a method
(passed into the selector): - (void)handleURLEvent:
(NSAppleEventDescriptor *)event withReplyEvent:
(NSAppleEventDescriptor *)replyEvent.
(...)
Another thing I've seen is adding a script suite and using
performDefaultImplementation and [self directParameter] to get the
URL.
When a URL is opened, an Apple Event of kInternetEventClass/
kAEGetURL is sent, containing the URL. If you want to handle the
URL, you'll need to catch this somehow.
Cocoa AppleScript support is fairly new (I think 10.2 or 10.3 or
thereabouts). So, depending on what system version your app has as
its minimal requirement, you'll either use NSAppleEventManager
(which is the older class, AFAIK) or the script suite. Instead of
performDefaultImplementation, I think you could also just create an
NSScriptCommand or whatever the class was called. Whatever feels
cleaner to you.
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden