Chapter 16. AppleScript
By scripting, we mean writing programs that act as “glue,” passing information between other existing applications in order to suit some purpose or act as macros, letting a user execute several commands in some program (or across several programs) with a single gesture. In this terminology, scripts are different than full-on applications because they lack a user interface; they just do their job and exit.
The highest-level scripting language on Mac OS X is AppleScript, initially developed by Apple in the early 1990s. AppleScripts enjoy a special dispensation on the Mac because of their native handling of Apple Events, which are simply messages that Mac applications can pass to one another. The majority of this chapter covers AppleScript, as well as AppleScript Studio, which is the Project Builder extension for building complete Aqua applications wrapped around AppleScript cores.
The Script Menu Extra

Figure 16-1. The Script menu extra
Apple’s Script
menu extra (see Figure 16-1) offers perhaps the most
convenient way to run scripts, both of the AppleScript and shell
script variety. It doesn’t appear in your menu bar
by default, but installing it is very easy: just run the
Script Menu.menu program, found in
/Applications/AppleScript. The Script menu extra pops into your menu bar and remains there until you manually remove it (by command-dragging it off of the ...