Launching a URL in OSX is Cake?

Geoff Canyon gcanyon at inspiredlogic.com
Thu Jan 24 17:08:01 EST 2002


At 11:40 AM -0800 1/24/02, Scott Rossi wrote:
>On a related note, I come from a print background where we created page layouts by having type set for us on photo paper and pasting it down onto boards with rubber cement.  Making corrections to anything required cutting the paper with an Exacto(TM) blade and pasting new type into position.  Try this sometime with 6 point legal type and make it straight.  You kids today with your fancy shmancy page layout programs and printers don't know how easy you have it...

I yield -- that sounds harder than writing a compiler, even on an abacus...

>At any rate, it seems that launching any old document is also possible without having to reference the document's creator application:
>
>  answer file "Locate file:"
>  put it into tPath
>  delete char 1 of tPath
>  replace "/" with ":" in tPath
>  put "tell application" && quote & "Finder" & quote & cr &\
>      "open file" && quote & tPath & quote & cr &\
>      "end tell" into s
>  do s as AppleScript
>
>This should open the target document as if it was doubleclicked.
>
>Shouldn't this be more difficult?

It _is_ slightly more difficult, since you need to watch out for the "/" character in the legitimate path, which will have been translated to a ":"

You could either escape the ":" which always gives me a headache, or do a character-by-character switch. I generally go the headache route, but I have no aspirin handy at the moment...

regards,

gc




More information about the metacard mailing list