O'Reilly logo

Mac OS X: The Missing Manual, Panther Edition by David Pogue

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Saving a Script

Before you save a script, let Script Editor check its syntax by clicking the Compile button. (If you don’t perform a syntax check manually before trying to save, Script Editor will automatically do it for you as soon as you try to save.)

Note

The Compile button won’t find any errors if you created a script using the “watch me” system. After all, Script Editor itself wrote the script, so of course it’s perfect. But when you write scripts by hand, as described later in this chapter, you’ll find the Compile button a useful tool for cleaning stray errors out of your scripts.

If Script Editor finds your script to be correctly written, you’ll get no reaction from Script Editor except to see your script formatted with colors and fonts, as shown in Figure 7-3. If it does find a problem with the syntax, you’ll be limited to saving your script file in only one format: plain text.

If you type an AppleScript manually, it appears just as it would in a word processor (top left): in Courier with no special formatting. When you click the Check Syntax button, however, Script Editor indents the tell block and changes all type to Verdana (bottom right), with AppleScript’s reserved words (language keywords and application keywords) in colored type and comments in smaller, italic type. Congratulations: You’ve got the Script Editor seal of approval.

Figure 7-3. If you type an AppleScript manually, it appears just as it would in a word processor (top left): in Courier with no special formatting. When you click the Check Syntax button, however, Script Editor indents the tell block and changes all type to Verdana (bottom right), with AppleScript’s reserved words (language keywords and application keywords) in colored type and comments in smaller, italic type. Congratulations: You’ve got the Script Editor seal of approval.

At this point, you’re ready to ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required