The most productive automation processes often use the same information at different steps in the workflow. For example, a the name of person could be used for addressing an email, and for titling a file attachment added to the same message. Having the ability to store and retrieve data during the execution of the workflow greatly increases its functionality and usefulness.
Automator's new Workflow Variables enables you to create workflows that can do more, and be more flexible in their design.
What, Where, and How
variable is used to describe a method of storing data. It's a virtual container that temporarily holds information, and passes it to the workflow when requested. A variable may contain textual data, a file reference, a list of object references, or just about any kind of data used by the workflow.
Automator provides two kinds of variables:
- Storage variables store information placed into them by the workflow. The information can be used as input or parameter values by actions in the workflow.
- Run-Time variables generate their content during the execution of the workflow. For example, the current date and the current IP address are two run-time variables whose content changes depending on the current state of the computer environment.
Workflow Variables are integrated throughout the Automator interface, making it easy to use and edit them.
Clicking the Variables tab in the source view (1) will display the Library of installed variables. They are grouped into categories (2) such as Date & Time, Locations, Text & Data, etc. When a category is selected, its list of available variables will display in the adjacent column (3).
The result of an action can be stored by following it with the Set Value of Variable action, which takes the result of the previous action and stores it in a variable chosen from its popup list of available variables (4).
Variables can be used in place of entered data in text input fields and path popup menus (5) in actions that have been updated to use the new Interface Builder controls in Leopard.
All of the variables used in the workflow are displayed in the Variables Table (6), a slide-in view activated by pressing the control at the bottom of the workflow window (7).
Individual variables can be edited by control-clicking them to summon their edit dialogs (8).