Store the Result

The idea behind Automator is to create workflows that process files and information. Often times, references to files and other information are passed from one action to the next action in the workflow. However, sometimes you may wish to use that passed information elsewhere in the workflow other than as input to an action. To store and retrieve information, Automator in Leopard provides a powerful new feature called Workflow Variables.

Variable is a term often used by programmers and software creators to describe a device for retaining data, almost like an invisible Tupperware container that temporarily holds information used by the workflow.

In the Welcome to the Party workflow, the results of the Ask for Text action, a person's name, will be stored and used to name the image file created by the Take Video Snapshot action.

With Automator, it's easy to store the results of an action in a variable and then use that stored information elsewhere in the workflow. Select the Utilities action group in the Library list, and then drag the Set Value of Variable action from the Actions List to between the two actions in the workflow.

Once you release the mouse, the action will be inserted between the two actions.

Click on the popup menu in the action view to create a new variable:

Once you've released the mouse, a new empty variable, called New Storage, will be created and added to the popup menu, and a Variables Options dialog will appear next to the variable.

In addition, the slide-in Variable Table view will be displayed at the bottom of the window. This table lists all of the variables in the workflow and their values.

In the Variable Options dialog, enter the title for the variable. Variables are usually given a title that reflects the type of data that they store, in this case, use the title "Name." Click the Done button and the new title will be reflected in both the action popup menu and the Variable Table.

You have now created a variable to store the name provided by the user.