Script Editor

Apple’s Script Editor offers a somewhat atavistic way to create and edit AppleScripts. Script Editor 2 (/Applications/AppleScript), shown in Figure 14-3, is the easiest way to write, compile, and run AppleScripts; and applies syntax highlighting when you compile your script.

The new Script Editor for Panther

Figure 14-3. The new Script Editor for Panther

Creating, Compiling, and Running AppleScripts

Just start typing into Script Editor’s lower text area, or paste or drag text from some other source into it. New text shows up in an orange-colored Courier typeface. While Script Editor features syntax-aware text highlighting and formatting, it doesn’t bother applying it until you ask for it by clicking the window’s Compile button or selecting ScriptCompile (Creating, Compiling, and Running AppleScripts-K). This causes Script Editor to compile (but not run) the script; if successful, it applies syntax highlighting to all that purple text, changing every term’s color and text style and every line’s indentation level as it sees fit. If it can’t compile the script due to a syntax error, it lets you know, by highlighting the point where the compiler got stuck.

Tip

The compiler performs application dictionary lookups as necessary to fetch application-specific keywords (which are colored blue by default). Thus, you can get away with referring to signatures ...

Get Mac OS X Panther in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.