Writing Commands by Hand

Using the “watch me” mode, you can create only very simple scripts. If you want to create anything more elaborate, you must type out the script steps one by one, testing your work, debugging it, reworking it, and so on.

Scriptable Programs

Most introductory articles about AppleScript discuss scripts that perform useful tasks in the Finder—that is, scripts that manipulate your files, folders, disks, and so on. That’s because AppleScript can control almost every element of the Finder, making it an extraordinarily scriptable program.

But AppleScript can also control and communicate with almost every popular Mac program: FileMaker, AppleWorks, Adobe and Microsoft applications, and so on. Sherlock, iTunes, iPhoto, iMovie, QuickTime Player, Terminal, TextEdit, Mail, Internet Connect, and Image Capture are among the built-in Mac OS X programs that you can control with AppleScripts, and the list is always growing.

Before you can write a script that manipulates, say, FileMaker, you need to learn which commands FileMaker can understand. Most Mac programs understand at least the most basic four AppleScript commands—Open, Print, Quit, and Run—but some offer a much larger AppleScript vocabulary. To find out, you need to look at the application’s dictionary—the list of AppleScript commands it understands.

To do so, open Script Editor; choose FileOpen Dictionary. You’re offered a list of all scriptable applications on your Mac. You can jump to the program you want by typing ...

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.