Example Workflow 1: Re-naming Finder Items

This example is easy-to-follow and useful. It's a great first workflow to introduce yourself to Automator. Click here to download the image files used in this demonstration.

Let's begin.

The group of image files pictured below are named in a manner typical to photos extracted from a digital camera or photo CD collection. Their numeric names do little to describe the content of the photos, making their identification more difficult. A more practical naming scheme would be to name the images sequentially with an identifier such as: Yosemite-001.jpg, Yosemite-002.jpg, Yosemite-003.jpg, etc.

However, re-naming a group of files in the Finder is a repetitive and time-consuming task, as each file must be individually selected and edited by hand. Re-naming a large group of files can take quite a while to complete. Using Automator, this task can be accomplished in seconds.

Step 1: Create a new workflow.

Automator automates repetitive tasks by applying a series of steps, called a workflow, to a group of specified items such as the image files displayed in the previous illustration.

Each step in the workflow is called an action. You create a workflow by first adding the items to process to the Automator window and then locating and adding the actions necessary to accomplish each step of the task.

The first step to automate the re-naming of the image files is to add them to a new Automator workflow. The easiest way to accomplish this in the Finder is to select the items to process and then summon the Finder Contextual Menu by clicking on the selected items with the Control key held down.

At the bottom of the Finder Contextual Menu is a sub-menu named Automator. Choose Create Workflow... from the sub-menu. A new Automator window will open, displaying a workflow that begins with an action that lists the items that were selected in the Finder.

Step 2: Find Actions.

The next step is to locate the actions needed to re-name the identified files and add them to the workflow. To find the appropriate actions quickly, use Automator's built-in search to locate actions by entering a name, keyword, category, or phrase into the Search field.

To begin the search, select the Applications library folder in the Library list view and type Command-Option-F to activate the Search field in the window toolbar. With the Applications group selected, the search will cover all installed actions. Note: to search a particular application library (like the Finder or iTunes libraries), select it first in the Library list view and then enter the search terms in the Search field.

With the search field active, type the word "name" and instantly all the installed actions related to naming items will be displayed in the Actions list view. Hit the Return key and the first item in the list of found actions will be selected. Using the up and down arrow keys, navigate the Action list until the Rename Finder Items action is selected.

(For an alternative method of adding Finder items to a workflow, see TIP #1 in the sidebar)

Step 3: Add an Action to the Workflow.

The next step in creating the workflow is to add the chosen action to the workflow. With the action selected in the Action List, hit the Return key to add the action to the end of the workflow.

A sheet will drop down into the Automator window displaying the following message:

Some Automator actions, such as renaming or image processing actions, alter items in ways that are not reversible. For safety, the addition of these actions to a workflow triggers a warning dialog informing the user of the potential of permenent data change and sometimes offering additional choices to preserve their orginal data.

Click the Add button in the alert dialog and the Rename Finder Items action is added to the workflow, preceded by the Copy Finder Items action that will create duplicates of the original items and pass references to the duplicate files to the renaming action to process:

(For an alternative method of adding actions to a workflow, see TIP #3 in the sidebar)

Step 4: Set the Action Parameters.

When an action is added to a workflow, a view is displayed in the Automator workflow containing controls for the action and any optional parameters the action may use. You can adjust these parameters to suit the needs of your workflow.

The Rename Finder Items action can use any of five available renaming scenarios: Add Date or Time to Item Names, Add Text to Item Names, Change Case of Item Names, Make Item Names Sequential, and Replace Text in Item Names. Select Make Sequential from the popup menu at the top left of the action view.

Once the menu item is selected, the action view will change to display the controls for renaming items in sequential order. Select the New Name radio button and enter a base name for the group of renamed items. Also select the checkbox for number length and make the number sequence three digits in length. A text example using the current settings will display at the bottom of the action view.

Step 5: Run the workflow.

Once the relevant actions have been added, you're ready to run the workflow by clicking the Run button at the top right of the Automator window. Each step of the workflow will execute in sequence, resulting in the specified files copied to the desktop and renamed.

Step 6: Save and re-use the workflow.

A powerful aspect of Automator is its ability to save workflows so that they can be used again and again. And since the process of renaming Finder items is something you're likly to do again, you can save this workflow and apply it to other selected Finder items in the future.

Currently, the workflow is designed to work only with the items you've already specified. To enable this workflow to work with other Finder items, you'll need to alter it slightly to make it more "generic" in its approach.

Delete the first and second actions from the workflow by clicking on the delete action button in their action title bars. The delete action button is the one with the "X" inside a circle located at the top right of each action view. Leave the Make Finder Item Names Sequential action as the only action in the workflow. Any items processed by the saved workflow will automatically be passed to it.

To allow the user of this workflow to edit the action parameters to suite their needs, the action view will need to be displayed when the workflow is run. Do accomplish this, click the Options disclosure triangle at the bottom left of the action view to display any special options related to the action. Click the Show Action When Run checkbox. This will cause this action's view to be displayed when the workflow is executed so that the user can set the parameters to meet the requirements for the selected Finder items.

Now you're ready to save the workflow. From Automator's File menu, choose Save As Plug-in... and from the forthcoming sheet in the Automator window, choose Finder from the Plug-in for popup menu to save the workflow as an extension to the Finder's contextual menu. Enter "Rename Finder Items" in the Save Plug-in As text input field and click the Save button.

You can now quit Automator and switch to the Finder desktop. Select the image files you previously renamed and then click on them with the Control key held down to summon the Finder contextual menu. In the Automator sub-menu you'll now see a menu item representing your saved workflow. Select Rename Finder Items from the menu to rename the selected items using the saved workflow.

Workflows saved as plug-ins or applications do not require the Automator application to run and instead will be executed by the system.

When a workflow is executed by the system, workflow status and controls are displayed at the top right of the main menu bar. The name of each action in the workflow is shown as it executes. Next to the name is a spinning progress indicator and next to the indicator is a red button that can be used to stop the workflow.

Once the workflow started, it will display the action view for the Rename Finder Items action in the center of the screen. Set the action parameters as shown and then click the Continue button.

The workflow will progress using the settings you input and rename each of the selected items on the desktop!

Congratulations, you've now used Automator to create a Finder renaming tool you can use at any time.