How to have your AppleScript "Open in Script Editor"
[Edit] I have made a Folder Action that does this automatically when you Export as Text an ApplScript from the Script Editor. See this post
[OP] I was wondering how people show their AppleSript in their web pages and, by clicking a link, have it open in your Mac’s Script Editor.
This is what I discovered (read back to front if you like!):
-
You create a link in your web page in this form:
<a href = "applescript://com.apple.scripteditor?action=new&script= your script ">Click to open in Script Editor</a>
-
where
your script
above is URL encoded -
where you can URL encode your script with this command as follows:
cat myscript.applescript | \ python3 -c "import urllib.parse, sys; print(urllib.parse.quote(sys.stdin.read()))" \ > myscript.urlencoded
-
Where
myscript.applescript
above is exported as text from Script Editor
So: tasks in order:
-
Export as text
-
URL Encode
-
Paste URL encoded text between the
...new&script=
and the">...
in thea
tag above