TweetFollow Us on Twitter

Getting Started with Automator

Volume Number: 25
Issue Number: 08
Column Tag: Automation

Getting Started with Automator

by Ben Waldie

Automator, introduced in Mac OS X 10.4 Tiger and significantly upgraded in Mac OS X 10.5 Leopard, is becoming a staple of many Mac users' daily routines. With Automator, users can quickly and easily create custom workflows to automate many of the time consuming and repetitive tasks they perform day in and day out.

The first thing to understand when it comes to Automator, however, is that it can't do everything. Automator is by no means the be all and end all of Mac automation. For more advanced automation, you'll want to look at something like AppleScript, or one of the traditional scripting languages like Python, Ruby/MacRuby or Perl. At present (Mac OS X 10.5.x), Automator has several key limitations, including its inability to perform branching logic, i.e. if X happens, do Y. Still, it will allow you to automate a wide variety of basic tasks on your Mac, including image resizing and manipulation, emailing, extracting content from the web, and more. And, you don't need to be a programmer or scripter in order to use it.

TIP: If you'd like to learn about AppleScript, be sure to visit the archives section on the MacTech website, where you'll find dozens of my AppleScript articles: http://www.mactech.com/articles/mt_indices/W_Authors.html

Getting Around Automator

Automator is found in the /Applications folder on your Mac. When you launch it, a workflow window is displayed with a Starting Points panel attached. See figure 1. Starting Points allows you to choose the type of information (files & folders, music & audio, photos & images, or text) you want to process, and where that information resides (online, on your Mac, in iPhoto, etc.) Based on your specifications, Automator will then use a template to create a workflow that gets you started. Of course, you can always create a custom, blank workflow too, if you prefer.

PLEASE NOTE: This article covers Automator in Leopard. If you're using Tiger, some features discussed may differ, or may not exist.


Figure 1. An Automator Workflow Window and Starting Points Panel

Actions

In Automator, workflows are made up of actions, each of which performs a specific task. To build a workflow, simply find the actions that do what you need, and insert them into your workflow in the order you want them to run.

When run within a workflow, most (though, not all) Automator actions will produce results, which can then be passed to other actions as input. This allows you to create a flowing workflow, which passes information along from one action to the next, much like an assembly line. For example, get a web page, locate any images on that web page, download those images to a folder on your hard drive, rename the downloaded images, etc. Most actions also have configurable settings, allowing you to adjust how the action will behave when run within a workflow.

Finding Actions

Along the left side of the workflow window, you'll find a library of all the actions that are available to you. Automator comes with a few hundred actions for things like Address Book, iCal, Mail, Preview, and Safari. Within this library area, actions are organized into categories. Just click on a category to view a set of corresponding actions, or quickly locate an action by typing some keywords into the search field above the library. See figure 2.


Figure 2. Searching for an Action

Beneath the action library, you can view a description of the selected action. Here you'll find information about what the action does, along with the type of input the action accepts (if any), the type of result the action produces (if any), and more. See figure 3.


Figure 3. The Description of an Action

Adding Actions to a Workflow

When you find an action you want to use, simply drag it to the right side of the window to add it to the workflow. At this time, the action's interface will be displayed, allowing you to configure its settings (if any). See figures 4 and 5.


Figure 4. An Action with No Configurable Settings


Figure 5. An Action with Configurable Settings

TIP: Want more actions? You can find loads of third-party actions in the Mac OS X Downloads section of Apple's website. http://www.apple.com/downloads/macosx/automator/.

Creating a Simple Workflow

Perhaps the best way to get started with Automator is to create some simple workflows. Let's walk through creating a workflow that will encrypt selected PDF files in the Finder, and attach them to a new outgoing message in Mail.

Launch Automator and create a new workflow. When the Starting Points panel appears, choose to create a Files & Folders workflow, to get content from my Mac, and to Use files & folders selected in the Finder when workflow runs. See figure 6.


Figure 6. Creating a Files & Folders Workflow

Automator will then start the workflow for you by automatically inserting a Get Specified Finder Items action. See figure 7. When the workflow runs, this action will locate any selected files in the Finder, and pass them to the next action in the workflow for processing.


Figure 7. An Action to Get the Files Selected in the Finder When the Workflow Runs

Click on the Files & Folders category in the actions library, and locate Filter Finder Items. Then, drag it to the end of the workflow area. Configure the action to filter for files whose File Type is PDF File. See figure 8. When run, this action will scan through the files it receives as input, and filter out anything that's not a PDF.


Figure 8. An Action to Filter for PDF Files

Click on the PDF category in the actions library. Find Encrypt PDF Document, and drag it to the workflow. Enter a password into the Password and Verify fields. See figure 9. This action will receive PDFs as input from the previous action, and it will then encrypt them. When it does this, it won't actually replace your original PDFs with encrypted files. Instead, it will generate new encrypted PDFs in a hidden temporary folder on your Mac. It will then pass these encrypted PDFs to the next action for further processing.


Figure 9. An Action to Add Encryption to PDFs

Click on the Files & Folders category again, and drag the Rename Finder Items action to the workflow. When you add this action to the workflow, Automator will display an alert, letting you know that this action will modify your files. It will suggest inserting a Copy Finder Items action first, so the original file names are retained. This isn't necessary, since the action will already be working with copies of the PDFs. So, just click the Don't Add button to skip adding the additional suggested action.

Next, set the uppermost popup in the Rename Finder Items action to Make Sequential. Then, select the new name radio button, and enter Encrypted PDF into the following field. You can leave the other settings alone. See figure 10. Since the previously inserted Encrypt PDF Document action will assign unique names to the newly processed files, this action will rename them to Encrypted PDF, followed by a unique numeric suffix. The renamed PDFs will then be passed on to the next action in the workflow.


Figure 10. An Action to Rename Encrypted PDFs Sequentially

With the Files & Folders category still selected, find the Move Finder Items action, and drag it to the end of the workflow. See figure 11. This action will receive the renamed encrypted PDFs from the previous action, and simply move them from the hidden temporary folder to the Desktop.


Figure 11. An Action to Move Renamed PDF Files to the Desktop

Click on the Mail category in the actions library, find the New Mail Message action, and drag it to the workflow. See figure 12. This action will create a new outgoing message in Mail, and attach the encrypted PDFs received as input. Feel free to fill in a default subject and message, if you'd like.


Figure 12. An Action to Attach PDFs to a New Mail Message

You can now test the workflow by selecting a PDF file in the Finder and clicking the Run button in Automator's toolbar. If all goes well, the selected PDF should be encrypted as a new PDF file named Encrypted PDF-1.pdf on the Desktop, and attached to a new outgoing message in Mail. This example should give you an idea of how to place actions together to form a complete workflow.

Saving and Running Workflows

Of course, it's not terribly convenient to have to launch Automator every time you want to run a workflow. Instead, it's much more useful to save your workflows, allowing them to be run outside of Automator.

There are actually two primary formats in which you can save Automator workflows. The first is a workflow file, which simply opens in Automator when double-clicked. The second much more useful format is an application, which will behave like any other application in Mac OS X. Double click on it to run it, place it in your Dock, and so forth. Automator workflows saved as applications also support drag and drop. To process a bunch of files, simply drop them onto the workflow application, and they will be passed to the first workflow as input.

Workflow Plug-Ins

Automator can also save workflows as plug-ins for certain applications and processes. To save a plug-in, just choose Save as Plug-in... from the File menu, and when prompted, choose the desired type of plug-in. Options include:

Finder Plug-in – The workflow appears in the Finder's contextual menu (when you control+click on something). Any selected files and folders are passed to the workflow as input.

Folder Action Plug-in – The workflow is attached to a specified folder in the Finder, and runs whenever items are placed into the folder. The newly added items are passed to the workflow as input.

iCal Alarm Plug-in – The workflow is saved and attached to an iCal event as an alarm. You can configure the event to run the workflow at the desired date and time. You can even put it on a recurring schedule!

Image Capture Plug-in – The workflow appears in the Automatic Task popup in the Image Capture application. You can choose the workflow to process images as you download them from your camera. For example, adding a naming convention to photos, importing them into iPhoto, and generating a PDF contact sheet.

Print Workflow – The workflow appears in the PDF popup at the bottom of the Mac OS X print window when printing a document in any application. Just choose the workflow to print the document to PDF and pass it to the workflow for processing. For example, printing an encrypted PDF directly to an email.

Script Menu – The workflow appears in a system-wide script menu in the menu bar, giving you a quick way to find and run the workflow at any time.

Advanced Workflow Techniques

Automator in Leopard also introduced some features for creating more advanced workflows, including looping and workflow variables.

Looping

In the Utilities category of the action library, you'll find a Loop action. Use this to create a workflow that loops for a specified number of times or period of time. Consider using this action in combination with the third-party Dispense Items Incrementally action (available from http://automator.us/leopard/downloads/index.html) to create a workflow that loops through files or folders one at a time.

Workflow Variables

Probably the most useful, yet underutilized feature of Automator is the ability to insert variables into a workflow. Variables allow you to make use of dynamic content, which is determined when the workflow runs. For example, use variables to add the current date and time to the subject of an email, to get the current machine's IP address or user name, and much more. Variables can even be used to store the results of an action, for later reference within the workflow. This offers a way to get around Automator's linear processing, that is, passing information down from one action to the next in sequence from start to finish.

In Closing

We've only scratched the surface here about what Automator can do, and I encourage you to take some time to explore it more on your own. After some time and practice, you should be able to put together some useful workflows that will no doubt save you time and effort in your daily life. As you get started, don't be afraid to try out different actions that are included with Automator, to see what they do. And, be sure to explore the hundreds more actions that are available from third-party developers. As I'm sure you'll quickly find, Automator is a great tool for reducing some of those simple and mundane repetitive tasks that you're currently doing manually. Until next time, automate your Mac and simplify your life!


Ben Waldie (ben@automatedworkflows.com) is president of Automated Workflows, LLC (www.automatedworkflows.com), a company offering AppleScript, Automator, and workflow consulting services to Mac-based businesses. For years, Ben has developed professional automated solutions for companies such as Abercrombie & Fitch, Adobe Systems, Apple Inc., CNN, Microsoft, NASA, PC World, and Time Magazine. Ben is the author of "Automator for Mac OS X 10.5 Leopard Visual QuickStart Guide" (Peachpit Press) and "AppleScripting the Finder", has written AppleScript and Automator content for Apple.com, Macworld, MacTech, MacScripter.net, and X-Ray Magazine, and is the host of the "Mac Automation Made Simple" video podcast (Peachpit Press). Ben has also released hundreds of Automator actions for use with Adobe Illustrator, InDesign, Photoshop, FileMaker, QuarkXPress, Twitter, and more.

 

Community Search:
MacTech Search:

Software Updates via MacUpdate

Latest Forum Discussions

See All

Go from lowly lizard to wicked Wyvern in...
Do you like questing, and do you like dragons? If not then boy is this not the announcement for you, as Loongcheer Game has unveiled Quest Dragon: Idle Mobile Game. Yes, it is amazing Square Enix hasn’t sued them for copyright infringement, but... | Read more »
Aether Gazer unveils Chapter 16 of its m...
After a bit of maintenance, Aether Gazer has released Chapter 16 of its main storyline, titled Night Parade of the Beasts. This big update brings a new character, a special outfit, some special limited-time events, and, of course, an engaging... | Read more »
Challenge those pesky wyverns to a dance...
After recently having you do battle against your foes by wildly flailing Hello Kitty and friends at them, GungHo Online has whipped out another surprising collaboration for Puzzle & Dragons. It is now time to beat your opponents by cha-cha... | Read more »
Pack a magnifying glass and practice you...
Somehow it has already been a year since Torchlight: Infinite launched, and XD Games is celebrating by blending in what sounds like a truly fantastic new update. Fans of Cthulhu rejoice, as Whispering Mist brings some horror elements, and tests... | Read more »
Summon your guild and prepare for war in...
Netmarble is making some pretty big moves with their latest update for Seven Knights Idle Adventure, with a bunch of interesting additions. Two new heroes enter the battle, there are events and bosses abound, and perhaps most interesting, a huge... | Read more »
Make the passage of time your plaything...
While some of us are still waiting for a chance to get our hands on Ash Prime - yes, don’t remind me I could currently buy him this month I’m barely hanging on - Digital Extremes has announced its next anticipated Prime Form for Warframe. Starting... | Read more »
If you can find it and fit through the d...
The holy trinity of amazing company names have come together, to release their equally amazing and adorable mobile game, Hamster Inn. Published by HyperBeard Games, and co-developed by Mum Not Proud and Little Sasquatch Studios, it's time to... | Read more »
Amikin Survival opens for pre-orders on...
Join me on the wonderful trip down the inspiration rabbit hole; much as Palworld seemingly “borrowed” many aspects from the hit Pokemon franchise, it is time for the heavily armed animal survival to also spawn some illegitimate children as Helio... | Read more »
PUBG Mobile teams up with global phenome...
Since launching in 2019, SpyxFamily has exploded to damn near catastrophic popularity, so it was only a matter of time before a mobile game snapped up a collaboration. Enter PUBG Mobile. Until May 12th, players will be able to collect a host of... | Read more »
Embark into the frozen tundra of certain...
Chucklefish, developers of hit action-adventure sandbox game Starbound and owner of one of the cutest logos in gaming, has released their roguelike deck-builder Wildfrost. Created alongside developers Gaziter and Deadpan Games, Wildfrost will... | Read more »

Price Scanner via MacPrices.net

New today at Apple: Series 9 Watches availabl...
Apple is now offering Certified Refurbished Apple Watch Series 9 models on their online store for up to $80 off MSRP, starting at $339. Each Watch includes Apple’s standard one-year warranty, a new... Read more
The latest Apple iPhone deals from wireless c...
We’ve updated our iPhone Price Tracker with the latest carrier deals on Apple’s iPhone 15 family of smartphones as well as previous models including the iPhone 14, 13, 12, 11, and SE. Use our price... Read more
Boost Mobile will sell you an iPhone 11 for $...
Boost Mobile, an MVNO using AT&T and T-Mobile’s networks, is offering an iPhone 11 for $149.99 when purchased with their $40 Unlimited service plan (12GB of premium data). No trade-in is required... Read more
Free iPhone 15 plus Unlimited service for $60...
Boost Infinite, part of MVNO Boost Mobile using AT&T and T-Mobile’s networks, is offering a free 128GB iPhone 15 for $60 per month including their Unlimited service plan (30GB of premium data).... Read more
$300 off any new iPhone with service at Red P...
Red Pocket Mobile has new Apple iPhones on sale for $300 off MSRP when you switch and open up a new line of service. Red Pocket Mobile is a nationwide MVNO using all the major wireless carrier... Read more
Clearance 13-inch M1 MacBook Airs available a...
Apple has clearance 13″ M1 MacBook Airs, Certified Refurbished, available for $759 for 8-Core CPU/7-Core GPU/256GB models and $929 for 8-Core CPU/8-Core GPU/512GB models. Apple’s one-year warranty is... Read more
Updated Apple MacBook Price Trackers
Our Apple award-winning MacBook Price Trackers are continually updated with the latest information on prices, bundles, and availability for 16″ and 14″ MacBook Pros along with 13″ and 15″ MacBook... Read more
Every model of Apple’s 13-inch M3 MacBook Air...
Best Buy has Apple 13″ MacBook Airs with M3 CPUs in stock and on sale today for $100 off MSRP. Prices start at $999. Their prices are the lowest currently available for new 13″ M3 MacBook Airs among... Read more
Sunday Sale: Apple iPad Magic Keyboards for 1...
Walmart has Apple Magic Keyboards for 12.9″ iPad Pros, in Black, on sale for $150 off MSRP on their online store. Sale price for online orders only, in-store price may vary. Order online and choose... Read more
Apple Watch Ultra 2 now available at Apple fo...
Apple has, for the first time, begun offering Certified Refurbished Apple Watch Ultra 2 models in their online store for $679, or $120 off MSRP. Each Watch includes Apple’s standard one-year warranty... Read more

Jobs Board

DMR Technician - *Apple* /iOS Systems - Haml...
…relevant point-of-need technology self-help aids are available as appropriate. ** Apple Systems Administration** **:** Develops solutions for supporting, deploying, Read more
Omnichannel Associate - *Apple* Blossom Mal...
Omnichannel Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Operations Associate - *Apple* Blossom Mall...
Operations Associate - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Read more
Cashier - *Apple* Blossom Mall - JCPenney (...
Cashier - Apple Blossom Mall Location:Winchester, VA, United States (https://jobs.jcp.com/jobs/location/191170/winchester-va-united-states) - Apple Blossom Mall Read more
IT Systems Engineer ( *Apple* Platforms) - S...
IT Systems Engineer ( Apple Platforms) at SpaceX Hawthorne, CA SpaceX was founded under the belief that a future where humanity is out exploring the stars is Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.