Handling custom URL protocols in Mac OS X?

Ben Rubinstein benr_mc at cogapp.com
Wed Oct 22 09:02:11 EDT 2008


Lyn Teyla wrote:
> I'm trying to get a standalone app to handle
> a custom URL protocol in Mac OS X.
> ...
> I can get the custom URL protocol to launch
> the standalone app, which is great (if you'd
> like to know how this is done, see the P.S.).
> 
> However, within the app, I have no idea how
> to find and extract the 'www.awesome.com'
> portion of the URL that was used to launch it.

Hi Lyn,

My code looks something like this:

	on appleEvent c, i, s
	  if ((c = "GURL") and (i = "GURL"))
	  or ((c = "LRUG") and (i = "LRUG")) then
	    request appleEvent data
	    put it into tURL
	    -- do something with the URL
	  else
	    pass appleEvent
	  end if
	end appleEvent

Note the crazy GURL/LRUG test; this became necessary when Intel Macs came out.
  I think it applied when running under Rosetta on an Intel Mac.  I don't know
if it's still an issue - ie whether it was a bug in Rev, or in Apple's code.

Thanks for the tip on how to register the custom URL protocol btw, which I'd
previously given my users detailed instructions on how to do on each machine.
    Do you/does anyone know if there's a way to have this done automatically
each time a new standalone is built?

TIA,

- Ben






More information about the use-livecode mailing list