Scripts are text files—which means that (at least in theory) you can write them in any old text editor. Scripting editors, in contrast, supply some tools that you'll soon find you can't live without.
A decent script editor should do three things:
Provide color-coding and indenting. This makes the script much easier to read (Figure 4.3).
Figure 4.3 Color coding and indenting in the ExtendScript Toolkit. Both serve to visually organize the script.
- Check syntax. Each scripting language follows its own syntax, or grammatical structure. The editor should check that syntax and warn you when you've run afoul of the law.
- Run the script. You should be able to run a script in a scripting editor by clicking a single button, as you can with Apple's Script Editor. Windows, in contrast, doesn't include a scripting editor. Without a third-party editor, in Windows you have to write your script in Notepad and then save the file with the correct extension (.js or .vbs). To run your script, you have to navigate to the file and double-click it. To debug the script, you have no option but to go back and forth until it finally runs successfully (or you die of old age).
Apple provides a free scripting editor called Script Editor with every Mac. Not only does it fulfill all of my requirements for script editors, it's perfect for beginners. Because some applications are "recordable" in AppleScript, you can record yourself manually performing tasks in a program, and they will be written out as AppleScript code in the editor—similar to recording Actions in Creative Suite or recording a macro in Microsoft Office. Before you get too excited, though, you should understand that few applications have been written to take advantage of this feature.
Two other AppleScript editors to consider are Satimage's Smile (available free at www.satimage.fr/software/en/index.html) and Late Night Software's Script Debugger (free demo, $199, available at www.latenightsw.com).
As mentioned earlier, the Windows operating system does not provide a free scripting editor. Instead, you must type your script in a text editor like Notepad, save it with the .vbs file name extension, and then double-click the file itself to run the script.