How to Run Applescript from HTML

You can run the Script Editor from a web page link.

For example, clicking on this link Try me! invokes this URL:

applescript://com.apple.scripteditor?action=new&script=display%20dialog%20%22Try%20me!%22

The Script Editor will pop up containing:

display dialog "Try me!"

Click on "Run" to compile and execute the script.

Here are some other examples:

Open Chess

Open Chess

This will invoke:

applescript://com.apple.scripteditor?action=new&script=tell application %22Chess%22%0D%09activate%0D%09end tell

The Applescript code is:

tell application "Chess" activate end tell

Open new Safari window with blank URL

Open new Safari window with blank URL

The link is encoded:

<a href="applescript://com.apple.scripteditor?action=new&script=tell application %22Safari%22%0D%09make new document with properties {URL:%22%22}%0D%09 end tell">Open new Safari window with blank URL</a>

The Applescript code is:

tell application "Safari" make new document with properties {URL:""} end tell