Andy IhnatkoIhnatko's Tiger Report: Automator

by - April 29th, 2005

 

 

I have to admit that I was a little bit wary when Automator was first announced. On my bandolier of Geek Scout merit badges, no patch receives higher prominence than AppleScript. I don't just write little scripts to automatically copy files to my iPod. I write full-blown applications with it. My weblog is updated and managed 100% by AppleScript, without any help from LiveJournal, MovableType, et al.

So I was worried that Automator might step on AppleScript's turf. Actually, if I'm going to be completely honest, I was worried that I've spent the past eight or nine years learning Esperanto. Or pursuing a Master's degree in fine arts. You know...something where you don't realize that you've been wasting your time until it's far, far too late.

But that's dumb. Automator is a fantastic boon to Mac users. Not just the geeks: it's a gift to ordinary users. Whenever I give a class on AppleScript, the simplicity of the language is my leadoff selling point. "Let's say you want to create a script that works on...well, let's say every item on the Desktop whose kind is 'Picture'," I begin. "What do you suppose the AppleScript code for that would be?" And then I tell them that the phrase I just used is indeed a working piece of AppleScript, and we're off and running.

Still, it's important to remember that just because I think it's cool, there's no reason to believe that it'll appeal to folks for whom a computer is just part of their workday, not part of their lifestyle.

Automator isn't the first "drag these graphical doo-dads around to create software" system. But it's the first that actually works as advertised. It's the first that isn't a colossal pain in the butt, the first that isn't way more complicated than just sitting down and learning how to use a "real" development system (like, hey...realBASIC).

You have a task that you wish to automate. You mentally break it down into steps. Then you rummage through a big bucket of Legos and look for bricks that resemble the steps that you have in mind. If you need help, just click on the Spotlight search field and type "resize an image" and presto...the list of bricks is narrowed to just the ones that resize images.

Snap 'em together in a stack. And gorblimey: it works. It just plain works. The mechanism is just so subtly-designed. Each one of these "bricks" is like a meat grinder. You toss stuff in the top of it, the crank is turned, and different stuff comes out through the bottom. So how do you cook a hot-dog, made from scratch?

Well, you start with a weiner-making machine. Drag that in there. What does the machine need? It says so right at the top of the box: it needs ground meat. Is there a meat-grinder in Automator's bag of tricks? Cool, there it is: drag it in above the weiner-maker. Oh, the grinder needs meat. Of course. OK, drag in an Action that locates a pork source on the hard drive. Put it at the top of the list.

Now all you need to do is drag a George Foreman Grill into the very bottom of the stack, and presto: an Automator action that spits out cooked weenies.

Like Spotlight, Automator will just get better and better as more and more publishers make their apps Automator-able. If you hit Apple's Downloads page, you'll find that Bare Bones Software has already released a fully Automator-studly edition of their text editor. Which means that anything that BBEdit can do, an Automator workflow can do. Given that BBEdit is a magic wand for text, this gives Automator a huge bump in features. With a well-tuned GREP search-and-replace, Automator can easily grab the text off of a webpage and isolate just that one bit of data that should be fed to the next step in the workflow.

I've been using Automator for a few months now, and while it's a blow to my ego that thanks to Automator, newbie Mac users can accomplish in minutes what took me months to learn with AppleScript, I can't possibly be sorry that it exists. I'm just reaping way, way too many rewards from it myself. Five minutes after I first launched Automator, I had a functional workflow that sets my Desktop wallpaper to the latest Astronomy Picture of the Day.

And that's not the half of it. Half the ginchiness of Automator is how well-integrated it is into the rest of the OS. Gosh, it'd be cool if that workflow could be run automatically every morning, so my Desktop is always current. No problem: I can just Export it to a recurring iCal appointment that happens at 6 AM every day. When I finish a column, lots of things have to happen before it goes into print and causes a tasty check to arrive on my doorstep. I've Automated the steps necessary to file my story with the correct editor, add the manuscript to The Ihnatko Archives, and invoice the publication's Accounting department for the job. Naturally. But I can also export it as a print option. Essentially, my "File Story" workflow is every bit a part of the Mac's standard printing interface as collating or multiple copies.

And as the Member Of The Extended Family Who Knows Computers And Stuff And Has To Keep Explaining How Things Work -- yes, dear reader, you're not the only one -- I'm going to make a lot of hay from Automator's ability to save workflows as standalone apps. I can't tell you how many times I've climbed into my car at some ungodly hour like 10 AM, so I could go to a cousin's house and "figure out why Safari's so frickin' slow." If he or she is using Tiger, I can just write a Workflow that does all of the mojo that I would otherwise have to do in person. My beloved cousin gets an app in the mail along with the terse instruction to try and double-click it without setting anything on fire. He gets his Mac fixed, I get to sleep until noon...everyone's a winner.

Finally, it's not like Automator is trying to replace anything. There are plenty of things that Automator can't do. It's more obedient than intelligent, and when you need your workflow to make an actual decision about something, you can have it hand things off to an AppleScript handler temporarily. You can use AppleScript to create brand-new Actions, too, and integrate Automator into your scripts.

And if I want to exploit Automator to make me look like King Geek of the Universe, well, here's a secret: there are plenty of Tiger features that can only be accessed through Automator. Tiger's new Core Image and Core Video routines. If you want to do some tricky 3-D transforms on your photos, you can either spend $500 on Photoshop...or you can drag three Actions together in Automator. Your choice.