Mac OS X's Automator utility offers a scriptless way to automate repetitive tasks. New, pre-defined templates and a better Services menu in the latest version allows you to be even more creative with setting up your own workflows.
The Automator utility in Mac OS X allows you to automate repetitive tasks (workflows) by a simple drag-and-drop process, rather than having to use a script.The new Automator in Mac OS X 10.6 has a new templates-based system that allows you to select from a few pre-defined templates for your new workflows. These include the standard Workflow and Application types, but also include iCal Alarm, Image Capture Plugin, Print Plugin, and a Services template. While all of these are interesting (i.e., the Print Plugin allows you to automatically manipulate data sent to the printer), the Services type is what we want to look at.
Due to the redesign and increased usability of the Services menu, the Services workflow can really allow for some creative things.
When creating a new Services workflow, the first thing you determine is the workflow's context. You can specify what application the workflow should receive input from and specify what type of input it will receive (which allows you to set the context and also gives clues as to what the Services menu differentiates as far as context goes). For instance, a few of the input types include text, dates, and email addresses as a text input, and PDF files, image files, or audio files as file/folder types (there are more distinctions available than just these).
Once you've set the context, you create the workflow as you would any other Automator workflow. For a real quick demonstration, select "text" for what the Service receives and then from the Automator library select the "Text" section. Drag the "Speak Text" action over to the workflow and then save the workflow. When you save it, Automator will save the workflow in the ~/Library/Services/ directory (so you can remove those you no longer want or edit those you need to change). Next, highlight some text from a document, right-click on it and from the Services menu select what you saved as the Services workflow and listen as the computer reads to you the text you highlighted. As you can see, it is very simple to create a new Automator-based Service. While this example is quite quick and perhaps a little cheesy, it illustrates how quickly you can create a workflow, and how easily.
With this sort of power, you can create a Services menu that will allow you to select a PDF, use the Watermark PDF Documents action to place a watermark on the document, then create an email with the file as an attachment. Or you can select text and run it through a shell script and replace the highlighted text with the new output (i.e., sorting or encrypting text). There really is a lot of diverse and interesting things that can be done and quite a few applications provide Automator support (either directly or indirectly via AppleScript). There really isn't a lot that couldn't be done with a little creativity.
For some pre-created Services, you can visit the Mac OS X Automation Web site, which has some Services available for download. There are other resources available on the site to help you get the most of creating new Services as well.
Vincent Danen works on the Red Hat Security Response Team and lives in Canada. He has been writing about and developing on Linux for over 10 years and is a veteran Mac user.