Saving a Script
Before you save a script, let Script Editor check its syntax. Do that by clicking the Check Syntax button at the right side of the window. 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 Check Syntax 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 Check Syntax button a useful tool for cleaning stray errors out of your scripts.
If Script Editor finds the syntax of your script to be correct, you’ll get no reaction from Script Editor except to see your script formatted, as shown in Figure 7-4. If it does find a problem with the syntax, you’ll be limited to saving your script file in only one format: plain text.
At this point, you’re ready to save your script. You start as you would in any Mac program, by choosing File→Save. Name your script and choose a location for it, by all means—but the important step to take here is to choose a format for your completed script (see Figure 7-5). Your choices depend on whether you’re working in the Mac OS 9 or Mac OS X version of Script Editor:
Text. You can’t actually run an AppleScript that’s saved as a text file, but saving it this way provides a good way to exchange scripts with other people or to save an unfinished script you want ...
Get Mac OS X: The Missing Manual, Second 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.