How do you write Scripts
Added 29 Jul 2008
You can’t write and run AppleScript scripts from any text editor. To write scripts, you need to use a special script editor, which will allow you to write the script, check the syntax, compile the script, run it, and save it as an applet.
Applet who? When you want to save a script in a way that it will run when the user double-clicks it, the option listed in the Apple editor is Application. However, in this article I will refer to it as an applet. An applet means the AppleScript code is wrapped with the minimal executable shell that allows it to run in a stand-alone form, just like any other application. To start, you may want to use Apple’s own free tool, Script Editor. Script Editor is a little application that comes preinstalled in the AppleScript folder in the Applications folder and is ready to use with every Mac system. Script Editor has always been a bare-bones AppleScript editor, which makes it rather easy to figure out and leaves few places to get lost. Besides Script Editor, a few other AppleScript editors are available with enhanced editing and debugging features.
Other AppleScript editors include Script Debugger from Late Night Software (www.latenightsw.com), which you can pick up for about $199, and Smile from Satimage (www.satimage-software.com), which is a powerful scripting program available as a free download. As you’re writing a script, you can compile and run it right from Script Editor. Even if you save it as a droplet or an applet, you can reopen, change, recompile, and run it right from the script window. This makes your scripts (and other people’s scripts, for that matter) easy to look at and try.