oreilly.comSafari Books Online.Conferences.


AddThis Social Bookmark Button

What Is Automator (and Can It Make Your Life Easier)

by Matthew Russell
Automator is a workflow application introduced as part of Mac OS X 10.4 (Tiger). It leverages the power of AppleScript to provide a drag-and-drop workbench for streamlining repetitive tasks. Unlike traditional scripting solutions, you create workflows by organizing packages of code called actions. Automator comes with a set of actions you can use right away. Plus Apple provides links to third party actions that you can add to your collection. Since you're working in a user interface, you don't need to know any programming to get started. Just arrange the actions in the order you want them executed and hit the run button. Those more comfortable with programming can, however, embed scripts inside workflows or develop new Automator actions. Once you've created a workflow, you can save and distribute it as a stand-alone application that can be used by others who have Mac OS X 10.4 or later.

In this article:

  1. Meet Otto
  2. To Automate or Not to Automate
  3. Creating Workflows
  4. Working Around Apparent Limitations
  5. Looking Ahead

Along with Dashboard and Spotlight, Automator was one of the most highly advertised features of Tiger. But since Tiger's release, things seemed to have slowed down a bit. Are we so mesmerized with Dashboard and Spotlight that "Otto" has fallen by the wayside and we're all unknowingly missing out? Let's take a closer look at Automator and see if it can really change the way we do our daily work.

Meet Otto

Unlike "the paperclip guy" you might have known in a former life, Automator is its own stand-alone application. Otto doesn't dance around on your desktop and offer you frivolous advice; instead, he makes it easy for you to streamline a series of tasks by helping you to create a workflow.

Workflows consist of a series of actions. An action is a purposefully simple little program that optionally takes input, performs a very specific task, and then passes the output to another action. If you've worked on the command line before, this type of architecture should remind you of the familiar pipes and filters architecture. It's simple, but can also be very elegant and powerful.

To simplify some of the daily drudge with Automator, you need to determine if the actions you'll need to make it happen are available. Without the actions to accomplish your workflow, Automator can't do much for you. To get started with Automator, take a moment to check out what actions are bundled by opening up Automator (located in you Applications folder, or type "Automator" in Spotlight) and then browse through the actions available at Apple's Automator Actions site.

To Automate or Not to Automate

If you've ever programmed or scripted before, you probably have predisposed expectations of what you want Automator to be able to do. When I first thought about Automator, I envisioned a very simple drag-and-drop GUI interface to some subset of AppleScript, where each action would really just be a generalized snippet of AppleScript or some other compiled code. Clearly, the emphasis would be on the stream of actions in the workflow but there would also be some room for basic "if ...then..." logic and iteration.

Related Reading

Mac OS X Tiger Pocket Guide
By Chuck Toporek

In reality, Automator is actually quite a bit more primitive than what I'd envisioned. While actions can virtually be any kind of code you want, there isn't any kind of conditional logic or iteration involved between the actions--at least not yet. The closest you'll come to branching and jumping around is with the crafty inclusion of scripts in your workflows. Sometimes including scripts works out quite well, but there are other times when going to this length seems to defeat the whole purpose of using Automator in the first place. But as we'll see, there are still plenty of times when Automator can get mindless jobs done before you could have even compiled an AppleScript.

Creating Workflows

Let's get some work done with Automator. An annoying routine task that many of us face these days is renaming images to something more sensible than what we normally get from our digital cameras or from out on the web. Since Spotlight comments are very helpful for adding additional metadata that allows you to easily find the images in a search, let's add some of those too. The comments will spare us from otherwise cluttering up the filename.

Our workflow requires only five steps. Automator actions are grouped by application, but you might find it easier to follow along by viewing one long alphabetical listing of them. Click on the Applications folder to get that listing.

When you open up Automator, you'll be greeted by an intuitive interface. Drag over a series of actions to create a workflow.
When you open up Automator, you'll be greeted by an intuitive interface. Drag over a series of actions to create a workflow.

For each of these steps, drag the specified action onto the workflow pane.

  1. Launch Application - Choose iPhoto from the list of options. We need iPhoto running, if it isn't already, so that the user can select images in it.
  2. Ask for Confirmation - Type in a message asking the user to select the photos in iPhoto that they'd like to rename and tag with Spotlight comments. This is our roundabout way of stalling and getting input from the user.
  3. Get Selected iPhoto Items - We want the images the user selected to pass onto the next action.
  4. Add Spotlight Comments to Finder Items - Leave the text field blank, but choose to "Show Action When Run" so that the user can input their comments on the fly. All comments will be applied to the entire batch of images.
  5. Rename Finder Items - Choose "Make Sequential" from the list of options, select the New Name button, and type "enter name here" in the text field beside the New Name button. (You might get a weird AppleScript error if you don't type something into the text field.) Choose to "Show Action When Run" with the expectation of the user replacing the temporary "enter name here" value with something of their choice at runtime.

create workflow
Create a workflow to rename and tag images with Spotlight comments.

Pages: 1, 2, 3

Next Pagearrow