Workflow Design Examples
|Choose an example:|
- Good Troubleshooting Practices for Automator Workflows
- Automator Workflow Additions Troubleshooting
- Uninstalling Actions
This example demonstrates how to use saved results to perform a batch process.
The batch process requires two Workflows:
- the Set-up Batch Workflow saves the items selected for batch processing into a global saved result, then launches the batch process by running the Batch Workflow,
- the Batch Workflow takes a group of items from the global saved result, processes them, and then removes them from the global saved result. The process is repeated until all the items in the global saved result have been processed or the Batch Workflow is stopped.
In this example, a Batch Workflow creates a series of archives (zip files) each of which contains exactly 100 files. When the number of files remaining in the saved result drops below 100, the Workflow stops. The unprocessed files remain in the global saved result until more files are added. As soon as the number of files in the global saved result reaches 100, the batch process begins again.
Set-up Batch Workflow – Add Files and Batch Archive in Groups of 100 Files
This Workflow takes the users selected Finder items and locates the files contained in any selected folder, including sub-folders, that the user may have selected. The Finder items are then combined with an existing global saved result (in which files for patch processing are stored). The saved result is then resaved (with the combined items as its content). The Batch Workflow is run to begin the batch processing.
In this example, the saved result is called "Files – Files for Batch Processing – Archive in Groups of 100 Files ". Here is a description of what each Action does:
This Workflow would be best saved as a plug-in for use in the Finder. This would make it executable from the menu that appears when you control-click a Finder item.
Batch Workflow – Batch Archive in Groups of 100 Files
This Workflow opens a global saved result and passes 100 items from the global saved result for processing. Once processing is complete, the 100 items are removed from the global saved result. The global saved result is then resaved. The Workflow is repeated until there are less than 100 items in the global saved result at which point the Workflow is stopped.
In this example the global saved result is called "Files – Files for Batch Processing – Archive in Groups of 100 Files" and the local saved result (i.e. only accessed in this Workflow) is called "Batch-100 Files". Here is a description of what each Action does.