Chapter 7. AppleScript

You can think of AppleScript programs (called scripts) as software robots. A simple AppleScript might perform some daily task for you: backing up your Documents folder, for example.

A more complex script can be pages long. In professional printing and publishing, where AppleScript enjoys its greatest popularity, a script might connect to a photographer’s hard drive elsewhere on the Internet, download a photo from a predetermined folder, color-correct it in Photoshop, import it into a specified page-layout document, print a proof copy, and send a notification email to the editor—automatically.

Even if you’re not aware of it, you use technology that underlies AppleScript all the time. Behind the scenes, numerous components of your Mac communicate with each other by sending Apple Events, which are messages bearing instructions or data that your programs send to each other. When you use the Show Original command for an alias, or the Get Info command for a file or folder, an Apple Event tells the Finder how to respond. Some of the files in the Speakable Items folder (Section 14.4.2.4), furthermore, are AppleScripts that quit your programs, open AppleWorks, switch a window into list view, and so on.

AppleScript veterans will find a lot of enhancements in Mac OS X 10.3—and there’s a nice surprise for first-timers, too.

Running Ready-Made AppleScripts

You don’t have to create AppleScripts to get mileage out of this technology. Mac OS X comes with several dozen prewritten ...

Get Mac OS X: The Missing Manual, Panther 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.