8.1. Introducing Automator
Automator, like most programs on your Mac, sits waiting in your Applications folder. Double-click Automator's icon to
it for the first time (Figure 8-2).
Automator's icon is a computer-generated robot image named Otto. (Get it? Otto Matic? Stop, you're killing us!) The icon is supposed to evoke an image of Automator as a servile program, executing your every
without question. Any similarity to the malevolent androids of I, Robot is purely coincidental.
In many ways, Automator's interface resembles that of iTunes; the brushed-metal look, the Play button, and even the Library list are all here. The process of working in Automator always flows from left to right. Click the
of the program you want to control (Library list), find what you want it to do (Action list), and drag it into the Workflow pane to build the list of steps you want your software robot to take.
8.1.1. Navigating the Screen
As shown in Figure 8-3, Automator has what looks like a confusing design. Nevertheless, once you learn what the various sections are for, the layout makes a lot of sense. Here's what the various
184.108.40.206. Search box
Just like the Search box in iTunes, Mail, and the Finder, Automator's Search Field works in real timeit displays matching actions as you type. But in this case, you can't use the Search box unless you first select a category in the Library list at left. You're telling Automator, "Search only within this category of actions." If you want to search for actions that deal with files in the Finder, for example, you select the Finder category in the Library list, and then proceed to type
in the Search box.
To search more than one category at once,
-click to select each category. Then type your search terms in the Search box as usual.Or, to search
of Automator's categories, click Applications at the top of the Library pane before searching. (That's the best way to find an action if you're not sure what category it's in.)
Your search results appear in the Action list, ranked by relevance (similarity) to your search terms. You can begin dragging actions directly into the Workflow pane at the right side to build a workflow, as described shortly.
Instead of clicking in the Search box before typing, you can make the insertion point jump directly there by using the standard Tiger "jump to the Search box" keystroke, Option-
Click the small gray X button in the Search box to return to the complete list of actions.
220.127.116.11. Workflow control
In the upper-right section of the Automator window, there are two buttons: Run and Stop. As you might guess, they "play back" and stop the workflow you're building.
To save screen space, you can hide the workflow control buttons, and the Search Field, by choosing View
Hide Toolbar, or by clicking the pill-shaped button in the upper-right corner of the window. (You can bring the toolbar back by choosing View
Show Toolbar or clicking the pill button again.)While the toolbar is hidden (and even when its visible), you can still start and stop playback by choosing Workflow
Run ( -R) and Workflow
Stop ( -period).
18.104.22.168. Library list
The Library list shows you every program on your Mac that can be controlled by Automator actions: Safari, Text Edit, iTunes, and so on. When you select a program, the Action list shows you every action that the
program understands. Then, when you find an action you want to use in your workflow, you drag it to the right into the large Workflow pane.
The Library list also includes a few items that are Mac OS X
, not programs:
. This category would be more appropriately called "Miscellaneous." It lists actions that don't fit
else. Here, for example, you find the Pause action, which makes your workflow wait for a few seconds while your Mac does something
; the Run AppleScript action, which lets you incorporate AppleScript code (Section 7.3.4) into a workflow; and the extremely useful Run Workflow action, which lets you
another workflow's actions into
workflow without having to copy and paste them in by hand.
. If you work in graphic design, this category's for you. Apply Quartz Filter to PDF Documents, for instance, lets you
PDF into black-and-white, or increase the brightness of a PDF. The new PDF Contact Sheet action takes a bunch of imagesdigital photos, for exampleand turns them into a single PDF document containing thumbnail-
previews, like a photographer's contact sheet. That's probably the coolest of all.
. This category gives you one-drag access to all the Automator actions that take advantage of Spotlight, Tiger's new search tool.
. This one could be called "Miscellaneous: The Return." The Burn a Disc action, for example, takes any files you specify and puts them on a CD or DVD (
, of course, that your Mac can burn discs). Also, don't
the Speak Text action, which takes any text you provide and reads it out loud in your Mac's noble attempt at comprehensible English pronunciation.
22.214.171.124. Action list
This list shows you the contents of whatever categories you've selected in the Library list. If, for example, you selected Safari in the Library list, the Action list would show you all the Safari actions available on your Mac. To build your own workflow, you have to drag actions
the Action list and into the Workflow pane.
the available Automator actions on your Mac, click Applications in the Library list.And if you're the type to brag about how many Automator actions you have (you know who you are), look at the bottom-left section of the window for a quick count.
126.96.36.199. Workflow pane
The Workflow pane is Automator's kitchen. It's where you put your actions in whatever order you want, set any action-specific preferences, and fry them all up in a pan.
But the Workflow pane is also where you see how the information from one action gets piped into another, creating a stream of information. That's how the Workflow pane differentiates Automator from the dozens of non-visual, programming-based automation tools out there. Figure 8-4 shows what a single action might look like in the Workflow pane.
When you drag an action out of the Action list into the Workflow pane, any
actions scoot aside to make room for it. When you let go of the mouse, the action you dragged materializes right there in the Workflow pane.
If you select an action in the Action list and press Return, Automator automatically
that action at the bottom of the Workflow pane.
Anatomy of an Automator action. You can drag the action by its title bar to move it to an earlier or later position in your workflow; the
number changes to
the action's new position.
188.8.131.52. Description field
The Description field provides some terse, superficial information on how to use your actions. When you click an action in the list, this box
shows you what the action does, what kind of data it expects to receive from the previous action (input), and what the action will send on to the
action (result). You also get a bite-sized icon of the program that the action controls, just for kicks.
To save space, you can hide the Description field by double-clicking the horizontal bar that divides it from the Library and Action lists. You can bring it back by double-clicking the same bar (now at the bottom of the window).You can use a similar trick to hide the lists at left, turning the Automator window into one big Workflow pane; double-click the vertical divider bar. Restore the standard layout by double-clicking the divider bar again.
184.108.40.206. New folder button
The + button in the lower-left corner of the window adds a new folder to the Library listto help you create a collection of favorite workflows, for example, or to assemble a collection of iTunes workflows you've found online. You can drag workflow files from the Finder right into this new folder, if you like, or even drag the icons from the
of open Automator workflows into your new folder to add them.
Unlike Mail, Address Book, the Finder, and just about every other Apple-made pr ogram in Tiger, Automator does
offer "smart folders." In other words, there's no way to create a constantly updated folder of workflows that contain a particular action, for example, or that you've worked on in the past week.
Once you've filled a folder with workflows, click its icon to see, in the Action pane, a list of every single action that's used in
of the workflows insidea great timesaver if you want to quickly steal an action from one of your existing workflows.
Automator comes with two factory-installed workflow folders: Example Workflows and My Workflows. Example Workflows contains workflows that Apple provides as teaching tools.My Workflows contains a list of all the workflows in your Home
Workflows folder. Assuming you do, in fact, save your workflows into that folder, the My Workflows folder is a great way to jump toor steal actions froma completed workflow.
8.1.3. Editing a Workflow
Before you build your own workflows, it's a good idea to understand how actions work together to process information. Here's a guided tour of the Process Images workflow (Figure 8-5), for example, that will give you deeper insight into building your
Ask for Confirmation
This common action, available in the Automator category, produces a dialog box that
the innocent workflow bystander what's about to happen (Figure 8-6). It's a good idea to begin each of your
workflows with a box like this, to
yourself (or your minimum-wage minions) what the workflow actually does.
If you want the dialog box to appear with a bright warning signto
you, for example, that you're about to erase your entire hard driveclick the robot icon in the upper-left corner of the Ask For Confirmation action. Automator swaps in a robot-with-yellow-triangle icon.Keep in mind, too, that the entire Ask For Conformation action is 100 percent customizable. Not only can you change the text that appears in the dialog boxyou can even change the
of the Cancel and OK
The Process Images workflow consists of only five actions. (The first action, which just displays an explanatory dialog box, shouldn't even count.) Still, this simple action does in 10 seconds what would take most
at least five minutes: applying the same photo effect to several images
Get Specified Finder Items
This action, from the Finder category, lets you specify which files you want your workflow to
on. You can use the + and - buttons to edit the listto add your own images to be sepia-
, for exampleor you can drag files straight from the Finder into this list.
Note this action's result: "Files/Folders." That's Automator's way of telling you that when the Get Specified Finder Items action is finished, it will pass on a list of files and/or folders to the
action in your workflow, ready for further processing.
This example workflow always operates on the same set of four files. But if you were to substitute the Finder
Ask for Finder Items action instead, Automator would prompt you for the files to process
you ran the workflow, which is a heck of a lot more useful than applying the same filter over and over again to the same four images.
A dialog box created by the Ask for Confirmation action. Feel free to edit the action with your own text; the stuff that Apple provides is pretty dry.
Copy Finder Items
This is a very important Finder action: it makes a
of the specified files and folders (in this case, the ones you identified in step 2) so you don't gum up the
. To specify where you want the copies stored, expand the white flippy triangle next to the action's title (Copy Finder Items). The pop-up menu lists obvious locations like Pictures and Desktop, or you can choose Other to choose any location you like.
The "Replacing existing files" checkbox simply tells Automator that, if there are old files in the Pictures folder with the same names as your new files, you want to delete the old files automatically.
Better yet, you can make Automator ask you where to store the copies
as the workflow is running
, so that the destination can be different each time. To pull off this neat
, click the Options flippy triangle. Turn on the Show Action When Run checkbox. Now, when you run your workflow, you'll see a dialog box ask where you'd like the newly
files to be stashed.
Apply ColorSync Profile to Images
This action (listed in the Preview category) processes the newly duplicated images from Part 3; in this case, it applies a sepia-tone filter to them. The action then
the newly tinted images onto Step 5. If you prefer, you can choose a different filter from the Profile pop-up menuto increase or decrease the lightness of the images, for example, instead of applying the sepia filter.
(By the way, the image of the girl is intended to
the filter's effect; it's not actually one of your photos.)
As described on Section 220.127.116.11, ColorSync is a technology for keeping colors consistent among computer monitors, digital
, printers, and so on. That's why most of the filters in the Profile pop-up menu are named after specific
and printers; by applying one of those filters to your images, you can compensate for the
discolorations that one of those devices has.(See www.apple.com/macosx/features/colorsync/ for the nerdy details on ColorSync.)
Open Images in Preview
This final action, which also comes from the Preview category, takes the post-filter images from Step 4 and opens them in Preview (Section 10.16). From there, you can flip, resize, or resave the images.
Try running the workflow by clicking Run. The lower-right corner of the Automator window tells you which step of the workflow is running at the moment. As each action finishes, a faint green check mark appears in its lower-left corner.
If something goes wrong while your workflow is running (or if you click Cancel in a dialog box), your workflow stops in its tracks. To identify the offending step, look for the faint red X in an action's lower-left corner.Unfortunately, though, if your workflow shuts down in the middle, you can't restart it from there. When you click Run the next time, the workflow plays from the first action again.