O'Reilly logo

Mac OS X: The Missing Manual, Second Edition by David Pogue

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Recording Scripts in “Watch Me” Mode

You can, if you wish, create a script by typing out the computer commands one at a time, just as computer programmers do the world over. Details on this process later in the chapter.

But if the task you want it to handle isn’t especially complex, you can create a script just by doing the job manually—using menu commands, dragging icons, opening windows, and so on—as Script Editor watches and writes out the necessary lines of code automatically. Recording an action and watching the Mac turn your movements into lines of AppleScript code is a fantastic way to learn how AppleScript works.

Unfortunately, as noted earlier, one of the biggest disappointments in Mac OS X is that the Finder is no longer recordable; that is, you can no longer create an AppleScript by performing certain actions as the Mac writes down what you’re doing.

Apple may someday restore recordability to the Mac OS X Finder. But in the meantime, you can try out recordability either in a Mac OS X program that is recordable, such as AppleWorks, or by restarting your Mac in Mac OS 9, where the Finder is recordable. Because not everyone has AppleWorks, the following tutorial takes the second approach.

A Simple Auto-Recorded Script

Try this experiment in Mac OS 9. (Do so if your Mac can start up in Mac OS 9 at all, that is. If not, read along anyway; the following section still provides a useful glimpse into the structure of scripts.)

The script you’ll build here creates a brightly colored, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required