I have an Automator service which works in Safari or Firefox. The service contains an AppleScript that copies the current URL then checks whether a target AppleScript applet is running. If not, it launches the applet and calls a handler inside passing on the URL to that handler. If it is running, the target applet is brought to the front and using GUI scripting a text field value in an already visible dialog is set to the URL.
But, workflows "as Services" cannot be granted assistive access so, the GUI scripting part fails. Workflow services are greyed out in the open file dialog of the Security & Privacy prefs pane. Giving the Automator app itself assitive access makes no difference. It seems that assistive access can only be granted to apps or applets.
I put the AppleScript code into an applet instead of a Automator workflow. I then manually edited the plist file to add the NSService dictionary details. That applet can be granted assistive access. But, that applet has to be manually registered in the Keyboards pref pane before it appears in the Services menu - just putting a copy in the Services folder didn't work. Also, running it inside Safari takes over a minute before the target applet is launched or brought to the front. So, I'm not much advanced.
I've tried getting a workflow service granted assistive access. It's very odd. Workflows are greyed out in the add apps dialog of the Security & Privacy prefs pane. But, you can add a workflow by clicking and dragging:
But, that has no effect. I get the following error:
So, I located Automator Runner in /System/Library/CoreServices and granted it assistive access:
But, that didn't work either. I still got the error that "Automator Runner is not allowed assistive access".
So, I'm snookered. I can't find an effective way to have an AppleScript based service granted assistive access. Any help would be great.
Garry