Sponsored Links

Mac Automation: Creating Watch Me Do workflows

Cory Bohon
Cory Bohon|January 19, 2009 9:00 AM
Do you want to use Automator's powerful features, but don't want to worry with "programming" the usefulness each and every time you wish to perform an action? With Automator for Leopard, you have the ability to easily record mouse moves/clicks and keyboard input with a feature called "Watch Me Do."

Initial Setup
Before using this Automator feature, you will need to turn on "Access for assistive devices." So head over to System Preferences > Universal Access. Make sure the checkbox is checked beside "Enable access for assistive devices." This allows Automator to control your mouse and keyboard movements/clicks/key presses. Watch Me Do will not work unless this box is checked.

Recording an Action in Automator
You are now ready to start recording your first Watch Me Do action in Automator. This feature gives Automator additional functionality if a prebuilt action is not readily available. So, before you go creating your own Watch Me Do action, look through the action list to make sure the functionality doesn't already exist.

When you are ready to record, press the "Record" button in the top-right corner of the window. The main Automator window will disappear, and you will see a heads-up display on the screen showing that Automator is recording; this display will also have a stop button -- when you are done recording your actions, you press this to return to the main Automator window. While recording, any mouse movements/clicks and key presses will be captured and added to your workflow.

Managing your recorded events
Each time you click, press a key, or move the mouse, you create an "event." Once you have recorded your Watch Me Do actions, you can reorder the specific events of the action. Just click and drag in the "Events" section. Be careful though, as some rearrangements can render the action workflow useless (i.e. reordering a click of a button before a specific dialog is displayed).

In the Watch Me Do action, you can also select a Timeout in seconds, and set the playback speed. Before changing these settings, note the defaults: Timeout is set to 0 seconds, and Playback Speed is set to 1x.

Read on to learn about running, saving, and get some tips about recording.

Running/Saving your recorded workflows
To run a recorded workflow that you created, just click on the Run button in the top-right of the Automator window. The workflow will run, and the recorded actions will be carried out.

In addition to just running your workflows, you can also save them for future reference. You can save the workflow as an actual Automator workflow file by clicking File > Save; choose "workflow" from the format drop-down menu. By saving as an Automator workflow all of your actions are preserved, and when you re-open the file, you will be presented with your workflow just as you left it. This is a great way to save your workflow for editing later on.

In addition, you can save workflows as an Application. When you save the workflow as an application, it will appear just like an application file (.app) and will allow you to run the workflow by double-clicking (just like a real application). You can save a workflow like this by clicking File > Save, and selecting "application" from the format drop-down menu.

You can also save any workflow as a plug-in for the Finder, Folder Actions, iCal Alarm, Image Capture, Print Workflow, or Script Menu. Let's try saving the workflow as a Finder plug-in. Select File > Save As Plug-in.

When you save an Automator workflow as a Finder plugin you will be able to access the workflow by right-clicking in any Finder window (including the Desktop) and pointing to More > Automator. (If you are using Mac OS X 10.4 Tiger, you can access this menu by right-clicking and pointing to "Automator"). In this Automator section, you will find all of your saved workflows; just click on one and it will start running.

Tips for Recording Events
While Watch Me Do is a neat idea, it isn't foolproof. One of the most common problems encountered with this feature is events not being recorded. If you are missing key or button presses, when you run the workflow you will encounter an error. To avoid events not being recorded, simply slow down and wait a few seconds between button clicks, key presses, or mouse movements while you are recording -- this will often fix this issue.

Another problem that you might encounter is when dealing with menu items. When you start recording, the Finder menu bar will be displayed; however, when you start running your workflow, the Automator menu bar will be displayed. If you are clicking on menu bar menus, items, etc., then be sure to click on the appropriate application in the Dock while recording -- this will ensure that the appropriate menu is displayed before the playback will click on one of these items.

These two issues are the ones that I have run into occasionally while using the Watch Me Do feature of Automator.

Want to read more about Automator? Visit TUAW's Mac Automation section today!
Universal Access.">