Mixing Automator and AppleScript


Since the release of Tiger, Automator has gotten a lot of press. In comparison to AppleScript, which is a true scripting language, Automator is a graphical environment for automating your Mac, and it’s much easier to use.

Still, Automator’s power is limited, since you’re restricted to automating “actions” that other people have already designed. That’s why it can be powerful to mix AppleScript and Automator, so you get both power and ease of use.

To incorporate an AppleScript into your Automator workflow, click the Automator category in the Library column, then double-click the Run AppleScript action in the Action column. After a short pause, the Run AppleScript action appears in the Workflow pane–the big rectangle on the right side of the window where you put your actions together.

To edit the script, simply replace the text “(* Your script goes here *)” with your actual AppleScript code. For example, you could replace the text with display dialog “This is an AppleScript test.”

Of course, the Run AppleScript action is only one of many Automator actions you can use in your workflow. Feel free to put other actions before and after your Run AppleScript action so that your workflow does something productive. Feel free, too, to use more than one Run AppleScript action within your workflow.

One idea: use several strategically placed Run AppleScript actions to keep track of your workflow’s progress. How? Use the AppleScript beep command. In the first Run AppleScript action, use beep 1, in the second Run AppleScript action, use beep 2, and so on.

And one other thing to keep in mind: Apple included more than a hundred pre-made AppleScripts with your Mac, compared to a measly three Automator workflows. Find the free scripts in /Library/Scripts/, and try mixing them into your Automator workflows!

Adam Goldstein is the author of AppleScript: The Missing Manual, Co-author of Switching to the Mac: The Missing Manual, Tiger Edition, and the president of GoldfishSoft.


Robert Munafo

You can get even more informative feedback with “say”.

say “please wait.”

say “step two.”

say “files processed.”

Nick Santilli

Thanks for contributing Adam. It’s a great opening for a little bit I’m writing up on Automator. I’m starting to use it more and more lately, and I’m enjoying the little bits of simplicity it’s adding to my daily (excuse the term) workflow.

now I gotta brush up on my applescripting a little (lot).

Comments are closed.