Automator is a brand new Mac OS X application. With it, you can automate tasks with drag-and-drop simplicity. Here's how it works. You use Automator to create a workflow. A workflow is a series of steps, called actions, each of which work with a specific application. For example, a Finder action might connect to a server or create an archive. A Mail action might check for new mail or send messages. You drag actions from a list to a workflow window, where you can set options, if necessary. There are two related concepts you must keep in mind when working with actions: Input is information required for an action to complete. Input can be something you provide, such as a selection of items in a window, or it can be the result of another action. Not all actions require input. Result is the outcome of an action. In many cases, it can be used by another action. Not all actions have results. For example, iCal's New iCal Events action takes Address Book groups from a previous action and uses them for an iCal event that includes group members as attendees. For this action to work properly, the previous action must result in Address Book groups. The next action can use the resulting iCal events, if necessary. When all necessary actions have been added to your workflow, you save the workflow so you can use it again and again. Each time you use it, it performs the steps or actions it includes, thus automating the task. This part of the chapter tells you how you can get started using Automator to build workflows and automate your tasks. Tips Automator includes dozens of actions that work with the applications that come with Mac OS X. More actions will be available as the technology catches on and developers create actions for their applications. You can learn more about Automator and download additional actions at Apple's Automator Web site, www.apple.com/automator/. If this introduction to Automator isn't enough for you, be sure to check out Ethan Wilde's Automator for Mac OS X: Visual QuickStart Guide.
To launch Automator Open the Automator icon in the Applications folder (Figure 1). Figure 1. The Applications folder includes two tools to automate tasks: AppleScript and Automator. An untitled workflow window appears (Figure 2). Figure 2. An untitled workflow window. To try the example workflows 1. | In the Library column of the workflow window, click the triangle beside Example Workflows. Workflows within the folder appear (Figure 3).
Figure 3. Automator comes with example workflows you can try.
| 2. | Double-click the workflow you want to try. It appears in its own workflow window (Figure 4).
Figure 4. Here's the workflow window for the Process Images example workflow. I won't tell you what it does try it for yourself!
| 3. | Click the Run button.
| Tips Don't try the Import .Mac Photo Album into iPhoto workflow unless you have iPhoto installed. Doing so will result in an error message in a pesky dialog that's not easy to get rid of. You can review the actions for a workflow by examining contents of the Action column and the workflow area on the right side of the workflow window (Figure 4). This is a great way to learn more about how actions work together in workflows.
To create a new workflow Choose File > New (Figure 5), or press . Figure 5. Automator's File menu. An untitled workflow window appears (Figure 2). To create a workflow 1. | Plan the steps of your workflow. The best way to do this is to manually perform the actions and make notes.
| 2. | In the Library column, select the application that will perform an action for the workflow. A list of installed actions appears in the Action column (Figure 6).
Figure 6. When you select a library, a list of installed actions for that library appears in the Action column.
| 3. | Drag the action you want from the Action list to the workflow area on the right side of the window (Figure 7). When you release the mouse button, the action's options appear (Figure 8).
Figure 7. Drag an action to the workflow area. Figure 8. The action appears in the workflow area, where you can set its options.
| 4. | Set options in the action. How you do this varies depending on the action. The action in Figure 8, for example, requires me to enter a URL. I'd click the + button to add a new URL to the list, then double-click the URL to display an edit box around it (Figure 9), type a URL, and press . Then I'd select the Apple URL in the list and click the button to delete it.
Figure 9. In this example, I'm preparing to enter a new URL.
| 5. | Repeat steps 2 through 4 for each action you want to add. Be sure to drag them into the workflow area in the order in which you want them to run. Figure 10 shows an example with a bunch of actions added.
Figure 10. Here are the actions for a workflow I dreamed up. The workflow downloads the latest Webcam image from a Web site I manage, then sends it via e-mail to all members of a group set up in Address Book.
| 6. | Use the pop-up menu for the input item at the top of an action (Figure 11) to indicate whether the input should come from the results of the previous action. Do this for each action as necessary.
Figure 11. Use a pop-up menu like this one to indicate whether an action's input should come from the previous action.
| Tips You can change the order of actions in the workflow area by dragging them up or down in the list. Automator visually indicates whether an action gets its input from a previous action, as shown in Figures 12 and 13. Figure 12 & 13. If an action uses the previous action's results for input, the action boxes connect (top). If an action doesn't use the previous action's results, the boxes do not connect.
Clicking the triangle beside Options in an action's configuration window displays additional options. Normally, this includes just the Show Action When Run check box (Figure 14), which, when turned on, instructs Automator to display each action when it runs as part of the workflow. You might find this useful for debugging the workflow, but in most cases, you'll want to keep this check box turned off. Figure 14. The Show Action When Run check box can help you debug a workflow.
You should be able to duplicate the workflow shown in Figure 10 and run it on your computer. Before you do, create an Address Book group with a few people you think might want to see the view out my window and select that group in workflow step 4.
To save a workflow 1. | Choose File > Save As (Figure 5).
| 2. | Use the Save Location dialog that appears (Figure 15) to enter a name and choose a location to save the file.
Figure 15. Use a standard Save Location dialog to save your workflows.
| 3. | Choose an option from the File Format pop-up menu:
Workflow saves the file as an Automator workflow document. Opening a workflow document opens Automator so you can run or modify the workflow. Application saves the file as an application. Opening the application runs it without opening Automator.
| 4. | Click Save.
| Tips If you save a workflow as a workflow format file in your Documents folder, it automatically appears in the My Workflows folder in the Library column of the workflow window (Figure 16). Figure 16. A saved workflow appears in the My Workflows folder in the Library column.
You can share saved workflow files with other Macintosh users so they can use them on their computers.
To open a workflow In the Finder, double-click the workflow icon. One of two things happens: If the workflow is a workflow document (Figure 17), it opens in Automator. Figure 17 & 18. Finder icons for an Automator workflow document (left) and an Automator workflow application (right).
If the workflow was saved as an application (Figure 18), it runs. Or In Automator, double-click the workflow in the My Workflows folder of the Library column (Figure 16). The workflow opens in Automator. To modify a workflow 1. | Open the workflow in Automator.
| 2. | Modify the contents of the workflow area as desired:
To remove an action, click the X button, at the top of the action's configuration window. To add an action, drag it from the Action column to the workflow area. To change the order of actions, drag them up or down in the workflow area.
| 3. | Choose File > Save (Figure 5) to save your changes.
| Tip |