Automator, a new application in OS X, provides an interesting framework for “end-user programming”.

The application allows the user to drag-and-drop actions, which tie together in a pipeline; there are no conditionals, but you can filter the output of one action before feeding it to another. I’m amazed by its power because of something I wanted to do in my research, but didn’t know how to do it easily.

I have generated webpages from my database, so I can easily browse through sequences of errors made by students. I also have index pages that provide an overview of all of a student’s sessions. What I wanted was PDFs of those index pages, so I could create hard-copy and work with them off-line. Saving 200 web pages to PDF did not sound like a fun job.

Enter Automator.

Automatorscreensnapz001

I went to the top-level page in Safari, and from there, ran the above Automator workflow. It takes the current page out of Safari (the top box), finds all the URLs (the second box), and then saves each of those URLs as a PDF in a directory of my choosing (third box). This took almost no time to string together, and only a few minutes to run (depending on network connection speed, of course).

The result? I have 200+ PDFs of web pages that I didn’t have ten minutes ago. Total effort? Almost zero.

To contrast, I have no idea how I would have scripted this from the command line. Rendering HTML documents to PDF would have involved a UNIX tool that may or may not exist; certainly, I would not have been able to do this in any reasonable amount of time myself.

So, AppleScript and it’s new wrapper/big brother Automator come to the rescue, and I’m well impressed. No doubt I’ll have more to say about Automator at a later point in time; given that you can write actions in Perl, Python, AppleScript, and Objective-C, it’s a programming environment with a great deal of potential.

Comments are closed.