Getting Started with AppleScript

AppleScript is a powerful computer language that's been around since the days of Mac OS 7. Despite its maturity, however, AppleScript is often criticized by seasoned Mac programmers for being too simple, too easy to learn, and too much like English.

Of course, those are precisely the traits you want in a computer language—assuming, of course, that you want to use a computer language at all. If you're an everyday Mac fan—as opposed to some computer-science Ph.D.—AppleScript is by far the easiest programming language to use for automating your Mac.

You can think of AppleScript programs (called scripts) as software robots. A simple AppleScript might perform some daily task, like backing up your Documents folder. 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, ...

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