blue check column
automator-actions.com gray to white fillAutomator Actions for Mac OS X Tiger
Automator Workflow Additions 1.0

Workflow Design Examples

Choose an example:   Batch Workflows Add, Remove & Execute Workflows Dynamic Folder Workflows

Batch Workflows

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.

This example uses the Save Result, Open Result, Resave Result, Stop if Result is Empty and Limit Result Actions.

Set-up Batch Workflow – Add Files and Batch Archive in Groups of 100 Files

Workflow Description
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. 

Example Description
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:

Set-up Batch Workflow
Click for an enlargement
  1. The Finder items that the user has selected are passed to the next Action.
  2. Files are extracted from any Folders passed from the previous Action.
  3. The global saved result is opened and combined with the Finder items passed from the previous Action.
  4. The global saved result is resaved with the result of the previous Action.
  5. The external Workflow – called "Batch Archive in Groups of 100 Files" – is run. This begins the batch process.

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

Workflow Description
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.

Example Description
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.

Batch Workflow
Click for an enlargement
  1. The global saved result is tested to see if it contains any items. (If the global saved result is empty the Workflow is stopped as there is no need to continue).
  2. The global saved result is opened and passed to the next action. The items passed from the test action (step 1) are ignored.
  3. The first 100 items passed from the previous Action are outputted to the next Action. (If the global saved result has less than 100 items in it the Workflow is stopped. To batch process all items in the global saved result, uncheck the ‘Stop if the number of items passed is less than limit’ checkbox.)
  4. The 100 files are saved into the local saved result.
  5. An archive is created from the 100 items passed from the previous Action. 
  6. The local saved result is opened and passed to the next action. The items passed from the previous action are ignored.
  7. The global saved result is opened and the items from the local saved result passed are removed.
  8. The global saved result is resaved with the result from the previous Action.
  9. The global saved result is tested to see if it contains any items. If the global saved result is empty, the Workflow is stopped.
  10. The Workflow automatically re-runs and continues to do so until it is stopped by the Limit Result Action (step 3) or the Stop if Result is Empty Action (step 9).