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

Google Chrome 96.0.4664.55 - Modern and...
Google Chrome is a Web browser by Google, created to be a modern platform for Web pages and applications. It utilizes very fast loading of Web pages and has a V8 engine, which is a custom built... Read more
Bartender 4.1.21 - Organize your menu-ba...
Bartender lets you organize your menu-bar apps by hiding them, rearranging them, or moving them to Bartender's Bar. You can display the full menu bar, set options to have menu-bar items show in the... Read more
CleanMyMac X 4.9.3 - Delete files that w...
CleanMyMac makes space for the things you love. Sporting a range of ingenious new features, CleanMyMac lets you safely and intelligently scan and clean your entire system, delete large, unused files... Read more
ffWorks 2.6.4 - Convert multimedia files...
ffWorks, focused on simplicity, brings a fresh approach to the use of FFmpeg, allowing you to create ultra-high-quality movies without the need to write a single line of code on the command-line.... Read more
Thunderbird 91.3.2 - Email client from M...
As of July 2012, Thunderbird has transitioned to a new governance model, with new features being developed by the broader free software and open source community, and security fixes and improvements... Read more
Adobe Photoshop 23.0.2 - Professional im...
You can download Photoshop for Mac as a part of Creative Cloud for only $20.99/month (or $9.99/month if you have purchased an earlier software version). Adobe Photoshop is a recognized classic of... Read more
VirtualBox 6.1.30 - x86 virtualization s...
VirtualBox is a family of powerful x86 virtualization products for enterprise as well as home use. Not only is VirtualBox an extremely feature rich, high performance product for enterprise customers... Read more
Merlin Project 8.0.2 - Project managemen...
Merlin Project is the leading professional project management software for OS X. If you plan complex projects on your Mac, you won’t get far with a simple list of tasks. Good planning raises... Read more
XMind 11.1.2 - Mind mapping and project...
XMind is a mind-mapping tool based off of the same open-source project as XMind Pro. It supports the same map structures and 100% compatible with XMind. It has new themes, some with more muted tones... Read more
WiFiSpoof 3.7 - Change your WiFi MAC add...
WiFiSpoof quickly and easily allows you to change your WiFi MAC address via hot-key or the system menu bar. Version 3.7: Fixed a potential issue with displaying current network on macOS Monterey... Read more

Latest Forum Discussions

See All

5 futuristic games like PUBG New State
The biggest flex of PUBG New State is its futuristic background. The new battle royale game is set in 2051. It has a new map, Troi, and also has a future version of Erangel. The weapon customization, drones, and other new features make it a new-... | Read more »
TouchArcade Game of the Week: ‘Jump Jerb...
I love games that don’t mess around. No frills or fluff, just “Here’s what I am and here’s what you get." That’s the vibe I get from Jump Jerboa from self-described “mostly solo" developer Chinykian. This is a minimalist one-button platformer that... | Read more »
SwitchArcade Round-Up: ‘Date Night Bowli...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for November 26th, 2021. In today’s article, we look at the rest of the releases for the week. There are a couple of good games in today’s batch, and we’ve got summaries of the whole lot... | Read more »
Musical 2D Platformer ‘One Hand Clapping...
Bad Dream Games’ One Hand Clapping was originally a project demo at the University of Southern California and it has evolved into a full game that blends music with 2D platforming. It was previously revealed for PC and consoles and it is also now... | Read more »
Best Black Friday 2021 iPhone and iPad G...
Just like last year, many retailers have been discounting and price matching games and hardware well before Black Friday. The App Store has some great deals on iOS games that are available right now and more that will likely start showing up in the... | Read more »
SwitchArcade Round-Up: ‘DoDonPachi Resur...
Hello gentle readers, and welcome to the SwitchArcade Round-Up for November 25th, 2021. Today is Thanksgiving in America, so many of you will be off work or school. In Japan, it is just Thursday, so I must work as usual. In spite of the holiday,... | Read more »
The Best Black Friday Nintendo Switch eS...
Hello, friends. It’s that time of the year again. The most magical of times, when over a thousand Nintendo Switch games get discounts on the eShop that make them very hard to resist. Unless you’re enormously wealthy, you’re going to have to make... | Read more »
Lineage2M: 4 Reasons to Be Excited About...
With staggeringly beautiful visuals and fast-paced gameplay, Lineage2M is high on everyone’s list of most anticipated mobile games before the end of the year. The upcoming Lineage title is set to land for PC and mobile devices on December 2nd so,... | Read more »
New ‘My Time at Portia’ Update Adds Supp...
Last week, a new content update for My Time at Portia ($7.99) from Pathea Games was announced. The game released on mobile a few months ago thanks to Pixmain and it is a pretty great conversion. | Read more »
Out Now: ‘Super String’, ‘Ghostbusters A...
Each and every day new mobile games are hitting the App Store, and so each week we put together a big old list of all the best new releases of the past seven days. Back in the day the App Store would showcase the same games for a week, and then... | Read more »

Price Scanner via MacPrices.net

Black Friday Sale: Get an 11″ M1 2TB WiFi iPa...
Amazon has the 11″ M1 2TB WiFi iPad Pro, in Space Gray, on sale for $1648.99 shipped as part of their Black Friday/Cyber Monday 2021 sale. Amazon’s price is $250 off MSRP, and it’s the lowest price... Read more
The best Black Friday/Cyber Monday 2021 deal...
Apple has a full line of 2020 13″ M1 MacBook Airs available and in stock today, Certified Refurbished, starting at only $849 and up to $190 off original MSRP. These are the best deals on 13″ MacBook... Read more
Expercom offers $40 discount on AppleCare+ wi...
Take $40 off 3-year AppleCare+ Plans ($209, regularly $249) when purchased alongside new 13″ M1 MacBook Pros at Apple reseller Expercom. All models are in stock today: – 2020 13″ MacBook Pro M1 CPU/... Read more
Black Friday Clearance Deal: 21″ iMacs for on...
Amazon has recently-discontinued 2020 21″ 2.3GHz Intel-based dual-core i5 iMacs (8GB RAM/256GB SSD) on clearance sale for only $879 shipped. Their price is $220 off original MSRP, and it’s the lowest... Read more
These wireless carriers will give you a free...
Apple’s wireless partners are offering several deals on iPhone 13 orders right now. If you’re an existing customer or willing to switch carriers, you can get a free iPhone 13 this Black Friday/Cyber... Read more
This 10.2″ Apple iPad is on sale for $319 for...
Apple’s new 9th generation 10.2″ is in short supply this Black Friday 2021 weekend, largely due to global supply constraints. Of all the Apple resellers we track, only one is reporting stock of the... Read more
The best Black Friday 2021 Apple Pencil sales...
Apple resellers are offing Apple Pencil models for 20%-23% off MSRP as part of their Black Friday 2021 sales. These are the cheapest Apple Pencils for sale this weekend: 1 – Amazon has Apple Pencils... Read more
Black Friday 2021: Take $20 off Apple Watch S...
Amazon has Apple Watch Series 7 models on sale today for $20 off MSRP including free shipping. Their prices are the lowest currently available for Series 7 Watches for Black Friday 2021: – 41mm Apple... Read more
Black Friday Only! Get last year’s 4-core Mac...
B&H Photo has last year’s Intel-based 3.6GHz 4-core Mac mini on clearance sale for only $429 for Black Friday 2021 only. Their price is $370 off original MSRP for this mini, and it’s the lowest... Read more
Black Friday 2021: Get an M1 Mac mini for as...
Looking for the cheapest Mac with an Apple M1 processor this Black Friday 2021? Apple’s Mac mini starts at $699, and resellers are offering models on sale this weekend for as low as $589 and up to $... Read more

Jobs Board

*Apple* Mac IT Support Specialist - Randstad...
Apple Mac IT Support Specialist **job details:** + location:Worcester, MA + salary:$40 - $45 per hour + date posted:Thursday, November 11, 2021 + job type:Contract + Read more
Senior Software Developer - *Apple* (iOS/tv...
**SUMMARY** Hulu's Apple team is seeking an experienced Senior Software Engineer with a passion for mobile applications to join our team in Seattle. Our highly Read more
*Apple* Management Engineer | Information Te...
Job postings Apple Management Engineer | Information Technologist II Share this: + + + + + | More (http://www.addthis.com/bookmark.php?v=250&username=pageup) Back to Read more
Department Manager- Tech Store (Full-time, Ge...
…+ Provide on-site support for in-shop repair on a variety of Apple computers and peripherals using advanced computer and electronic repair techniques and Read more
*Apple* / Macintosh / Jamf / Adm Systems Adm...
…Administration **Duties and Responsibilities** + Configure and maintain the client's Apple Device Management (ADM) solution. The current solution is JAMF supporting Read more
All contents are Copyright 1984-2011 by Xplain Corporation. All rights reserved. Theme designed by Icreon.