Automator: "The action “Watch Me Do” encountered an error."

Hi, I'm trying to do the following with an Automator app:


  1. Launch Firefox (it's actually already running I just want to focus on it)
  2. Record a "Watch Me Do" event
    1. Cmd+Tab+1 in FF
    2. Click a button on the page


When I save it as an application and try to run it, I get the following error:


The action “Watch Me Do” encountered an error.

Check the actionʼs properties and try running the workflow again.


Could use some help figuring this out


It works within automator. I suppose I could try launching Automator as step one of the app?


Thank You 🙂


User uploaded file

Posted on Nov 30, 2013 10:08 AM

Reply
7 replies

Dec 5, 2013 1:05 PM in response to xroox

I know you already worked out your problem, xroox, but I just ran into a very similar problem and found a much simpler solution. I thought I'd record it here for anyone else who might run into this in the future.


In my case, I was tying to use Automator to record a service that would simply click the Fast User Switching menu in response to a keyboard shortcut. Like you, my workflow ran perfectly as long as Automator was open, but failed with the "'Watch Me Do' encountered an error" message if it was not.


Turns out, in Mavericks, even Finder needs special permission to control your computer this way.


To give it the permission it needs, go to System Preferences > Privacy > Accessibility and select the checkbox next to Finder (you'll probably need to click the padlock in the lower left corner first and enter an admin password).


I suspect the same instructions, but for Firefox instead of Finder, would have worked for you, xroox.


UPDATE: On further review, the "Watch Me Do..." error will be generated every time the service is invoked if the currently selected application has not been granted permission to control the computer in the Privacy > Accessibility prefs. For my purposes, I guess this means that I need to grant permissions to my most frequently used apps on a case-by-case basis as needed, or remember to manually switch to Finder first.


Anyone with a better solution?


Message was edited by: phoward8020

Nov 30, 2013 11:36 AM in response to xroox

You could try replacing the ⌘ tab 1 with a script, and have Automator run that script as part of the workflow.

Automator would seem to be a work in progress, especially for things like this. I have never been able to get it to work reliably for automating things like button presses.

For that, quickeys seemed to work much better: Startly - QuicKeys 4 for Mac OS X


Here's a good reference for scripting keystrokes: lion - How do I automate a key press in AppleScript? - Ask Different

Nov 30, 2013 12:17 PM in response to xroox

Nice program. 🙂

I usually do this with this python script:

The benefit of this is that you can take the code you need and put it right into your script or Automator to do only the clicks you want, no need to call anoher program or script.

I also have the code to do a mouse "drag" if interested.



#!/usr/bin/python
##############################################################
#               Python OSX MouseClick
#       (c) 2010 Alex Assouline, GeekOrgy.com
##############################################################
#
import sys
try:
        xclick=int(sys.argv[1])
        yclick=int(sys.argv[2])
        try:
                delay=int(sys.argv[3])
        except:
                delay=0
except:
        print "USAGE mouseclick [int x] [int y] [optional delay in seconds]"
        exit()
print "mouse click at ", xclick, ",", yclick," in ", delay, "seconds"


import time
from Quartz.CoreGraphics import * 
def mouseEvent(type, posx, posy):
        theEvent = CGEventCreateMouseEvent(None, type, (posx,posy), kCGMouseButtonLeft)
        CGEventPost(kCGHIDEventTap, theEvent)
def mousemove(posx,posy):
        mouseEvent(kCGEventMouseMoved, posx,posy);
def mouseclick(posx,posy):
        mouseEvent(kCGEventLeftMouseDown, posx,posy);
        mouseEvent(kCGEventLeftMouseUp, posx,posy);
time.sleep(delay);
ourEvent = CGEventCreate(None); 
currentpos=CGEventGetLocation(ourEvent);         # Save current mouse position
mouseclick(xclick, yclick);
time.sleep(delay);
mousemove(int(currentpos.x),int(currentpos.y));   # Restore mouse position
print "done."

Dec 5, 2013 1:33 PM in response to phoward8020

UPDATE #2: This issue is discussed in greater depth here: http://www.macosxautomation.com/mavericks/guiscripting/index.html


Also, it appears that the answer to the question I posed in the above post (which I can no longer edit, for some reason) is to save my workflow as an Applet instead of a Service, and code-sign it. At that point, it should work without the constant granting of permissions. Unfortunately, that makes it harder to invoke it from a keyboard shortcut anywhere in the system.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Automator: "The action “Watch Me Do” encountered an error."

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.