com.automator.runner.xpc is not allowed to send keystrokes
I have two MacBooks. Both run the same MacOS version. I installed the same Automator script in both. But on the older MacBook I get:
The action “Run AppleScript” encountered an error: “System Events got an error: com.automator.runner.xpc is not allowed to send keystrokes.”
I added Automator to the Security -> Accessibility section in both. It even works on the older one. But then it suddenly stops. It just don't get why...
I have solved this issue recently in case anyone is interested in how. It is NOT actually necessary for System Events to have direct Accessibility privileges. What you need to add are a total of 3 apps, Automator, Script Editor, and AppleScript Utility.
The Automator and Script Editor apps are found within the ~/Applications
and ~/Applications/Utilities
folders, respectively. What is harder to find is the AppleScript Utility app, seen below:
To add AppleScript Utility app, click the +
button on Accessibility, then navigate to (a shortcut is CMD+SHIFT+G
)
/System/Library/CoreServices
then open
the application called AppleScript Utility
.
Afterwards, run a script in automator again, which updates the privileges and things should run well after. In summary, Automator, Script Editor, and AppleScript Utility need to be added to Accessibility.
I found that all applications involved that are targeted by the Automation also need to be given Accessibility permission. So, if your Automation reloads a page in Chrome then both Chrome and Automator require Accessibility permissions.