With the release of Panther (Mac OS 10.3) Apple has built in a new technology, called URL Protocol Support, that allows for a clickable link in a browser to launch Script Editor and populate it with a script. This makes it easier to share AppleScripts online.
On my handy little script section of Objective Labs I’ve just implemented support for this new feature.
Apple has an AppleScript that is sort of cumbersome in that you have to pre-convert your scripts into clickable links to put them online. If you’re a big geek like me, and you store your scripts in a database, it’s easy to use php to convert a script to a clickable url protocol link on the fly.
Just use this php code:
$yourScript = rawurlencode($the_variable_holding_your_script);
and place it in the scirpt portion of the link like this:
<a href=”applescript://com.apple.scripteditor?action=new&script=<?PHP echo $yourScript; ?>>The Link</a>
And you will end up with something like this:
Panther users click here to open this in script editor.
ozzy says:
Tim your website sucks ass where’s the funny shit that used to make me giggle like a little school girl?
November 3, 2003 — 11:09 pm
rossco says:
how do you run or launch an applescript by simply using a link on a webpage?
eg would this be correct?
The Link
or is it a lot simpler to activate a script?
December 9, 2003 — 10:56 am
Tim says:
The “script” or php code is only necessary because I’m pulling them from a database. If you just want to add them to a webpage use apple’s encoder so it’s a url right in your webpage as demonstrated here.
December 9, 2003 — 5:04 pm