Com.automator.runner.xpc is not allowed to send keystrokes

applescriptautomatorkeyboard

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…

Best Answer

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:

enter image description here

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.