Individually Looping Through Files in an Automator Workflow
- The Looping Problem
- Dispense Items Incrementally Action
- Automator Multi-Item Processing Utility
- Conclusion
Since its inception, Automator in Mac OS X has seen numerous improvements. One such improvement, which was introduced with the release of Mac OS X 10.5 Leopard, is the ability to create looping workflows.
Creating a looping workflow is relatively straightforward. Simply insert the Loop action, found in the Utilities category in Automator's action library, into the desired location within your workflow. When the workflow runs and reaches the Loop action, Automator returns to the beginning of the workflow and starts again. The Loop action offers some options; for example, it can be set to loop automatically for a specified number of times or minutes, or to ask you if you want to continue looping or proceed with the remainder of the workflow. You even have some control over how the workflow's input is handled between loops.
Although a fine start, looping of this nature still possesses one major limitation: There's no way to loop through a series of files, passing them one at a time through your workflow.
The Looping Problem
When a set of files is passed to an Automator workflow as input, that set of files is passed through the workflow all at once. This approach can present a major problem in certain situations. For example, suppose you need to add security options, such as an open password, to 1,000 Microsoft Word 2008 documents. To do this, your workflow would need to perform the following primary tasks for each document:
- Open the document.
- Apply the security options.
- Save and close the document.
Because of the way Automator passes input from action to action, the workflow would begin by opening all 1,000 documents in Word at the same time, before passing them as a whole to the next actions in the workflow. Surely it's not desirable (probably not even possible) to have 1,000 documents open in Word at once. When processing large numbers of documents, it would be ideal to process the documents through the entire workflow, one at a time. This way, only one document would be opened in Word at any given time.
Unfortunately, as I mentioned previously, Automator doesn't include any built-in way to perform individual file looping. But some third-party options are available to help! The following sections show two different options for getting past this Automator limitation.