Use variables in Automator on Mac
You can add a variable to a compatible field or pop-up menu of an action, or add a variable to a workflow and have the value of the variable used by the actions that follow.
- Click Variables in the top-left corner of the Automator window, then select a category from the Library. - The variables related to that category are displayed. 
- Do either of the following: - Add a variable to a specific action: Drag the variable you want to use onto the field or pop-up menu of an action. A green plus sign - appears if the variable is compatible. 
- Add a variable to your workflow: Drag the variable you want to use into your workflow. A Get Value of Variable action is added to the workflow. The value of the variable is passed to the next action. 
 
Tip: Choose View > Variables to show the values of the variables in the Log area while your workflow runs.