Fragile Nature of Automator and Watch Me Do

There are limits to what Automator can achieve and one fragile action in particular is the focus of this article, Automator's "Watch Me Do".

Automator is a tool for creating workflows; sequences of tasks that interact with OS X applications and files. Automator is created by Apple, included with OS X, and has been steadily improved.

There are limits to what Automator can achieve and one fragile action in particular is the focus of this article, Automator’s “Watch Me Do”.

Watch Me Do

“Watch Me Do” is an action available to Automator workflows. The action records user actions and interactions with the computer. Mouse moves, clicks, and input on the keyboard are recorded with as much context as possible.

Screenshot of Automator Watch Me Do action

On playback, the “Watch Me Do” action simulates the previously recorded sequence of actions as accurately as possible. This often leads to Automator being able to record and repeat complex interactions.

Problems appear because the playback is only often right. Mouse coordinates are recorded exactly, clicks are pin-point accurate, and text is typed regardless of if the underlying designation is ready for it. “Watch Me Do” requires the environment to exactly match the environment in which it was recorded. If a window takes too long to open, or an underlying text field changes, the playback will continue regardless – with a high risk of unintended consequences.

This requirement is difficult to achieve and makes the “Watch Me Do” action fragile.

“Watch Me Do”’s behaviour is achieved through the OS X’s Accessibility support.

Power Manager

You likely have a workflow or two scheduled with Power Manager. If you have ever used the “Watch Me Do” action, it is likely you were surprised to see your scheduled event fail. This happens for known but obscure reasons. Thankfully this is easily fixed.

Enable Accessibility for pmuser

For Power Manager to replay a “Watch Me Do” Automator action, you need to provide Power Manger with access to your Mac’s Accessibility support:

  1. Launch System Preferences.
  2. Select Security & Privacy and unlock the panel.
  3. Select the Privacy tab.
  4. Select the Accessbility settings.
  5. Under Allow the apps below to control your computer. enable pmuser.

Screenshot of OS X Accessibility settings

pmuser is an assistant of Power Manager used to perform your actions. After granting pmuser permission to use OS X’s Accessibility support, your scheduled Automator workflow events will work.

Accessibility versus Security

Accessibility is protected in OS X for security reasons. Through the Accessibility support of OS X, an assisting application has much greater insight into other applications on your computer. This is required to assist you, but it also weakens barriers put in place to protect you from malicious applications and processes.

Alternatives

Where possible, avoid using or relying on Automator workflows that include “Watch Me Do” actions. Such workflows are prone to problems. “Watch Me Do” is best suited to prototyping workflows, rather than long term solutions.

Alternatives include using specialised Automator actions, GUI AppleScript, or third party tools like Sikuli.