Sunday, November 10, 2024

keyboard – Fixing “not allowed to send keystrokes” error in Automator workflow

MacOS Ventura 13.3 but I have had some form of this problem on and off for a couple years.

I have a simple workflow that types the current date in ISO 8601 format, it is a single AppleScript action like tell application "System Events"...keystroke $DATE essentially. It breaks, often, with an error saying the workflow is “unable to send keystrokes”. Perhaps something resets on OS upgrades, I’m not sure, but I wish I better understood the steps necessary to fix it. I gave Automator, AppleScript Utility, and the workflow itself the Accessibility permission “allow the applications below to control your computer”—as this answer says—but that alone does not seem sufficient (but might be necessary?). I don’t see any relevant keyboard settings.

I suspect some or all of these apps also need to be on the Settings > Privacy & Security > Automation list…except there is no way to add (or remove, for that matter) apps to that list. There is no “plus” button and dragging an app onto the list does nothing. I’ve read here and in Apple’s forums some suggestions that an app is supposed to request this permission the first time it needs it and to add an app to the list you should reinstall it. A fine solution…but you cannot reinstall Automator or AppleScript Utility, they cannot be deleted. The workflow itself also does not trigger a prompt for this permission, as far as I can tell, and I doubt giving it access would be enough. How is one supposed to add applications to the Automation list? Is there a CLI to this list?

Related Articles

Latest Articles