• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Custom URL Handling
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


  • Follow-Ups:
    • Re: Custom URL Handling
      • From: Uli Kusterer <email@hidden>
References: 
 >Custom URL Handling (From: Jacob Bandes-Storch <email@hidden>)
 >Re: Custom URL Handling (From: Uli Kusterer <email@hidden>)

  • Prev by Date: Re: I don't understand why this is leaking...
  • Next by Date: Re: compiling a bundle on intel?
  • Previous by thread: Re: Custom URL Handling
  • Next by thread: Re: Custom URL Handling
  • Index(es):
    • Date
    • Thread