Open this Scriplet in your Editor

Hello, How does one implement the “Open this Scriplet in your Editor:” link on this (and other) sites in order to open applescript code in the script editor? The applescript itself is encoded - in hex? - after the link that is called in the html. I’d like to be able to use the link on a site. I searched and couldn’t find an answer; is it a trade secret? :slight_smile: Thanks.

It’s not secret, and the scripts are just recoded as HTML (one long string - returns aren’t used in HTML) so they’ll appear as they should in the forum. In earlier versions of OS X, there was an article in Apple’s developer docs with an AppleScript for doing the encoding and a description of the AppleScript bbcode link and how to declare it on your server. I can’t find it now because I can’t recall what it was called.

With respect to the bbs, nothing secret is done; there’s a proprietary php script that encodes the submitted script and appends it to the link, and there’s code so the server recognizes the [AppleScript]…[/AppleScript] tags.

Thanks - I didn’t think it was very secret (!) as the same kind of links are on other sites. I found some info on encoding and someone else’s attempt to do what I’m thinking, so I think I’ll try and write an applescript that takes the text of a script from the clipboard and encodes it and formats it into an “Open in Script Editor” link for pasteing…

URL Protocol Messaging



.followed by the encoded script.

Thanks for that link! - songdog

Thanks, Bruce – senior moments are accelerating in frequency! :o

Forgot to post the encoding scriplet, after all; code borrowed from

Copy the text of your Applescript to your clipboard (right out of the Script Editor), run the script below, and then paste your encoded Applescript into a Web document:

set TheCode to do shell script "python -c 'import sys, urllib; print urllib.quote(sys.argv[1])' " & quoted form of (the clipboard)
set the clipboard to "Click here to open this script <a href=\"applescript://" & TheCode & " \" target=\"_blank\">in your Script Editor </a>:"

Below is the Applescript above, encoded thusly for the Web:

Click here to open this script <a href="applescript:// " target="_blank">in your Script Editor </a>: