1
votes

I have a Quick Action that runs an AppleScript program which needs to click a button. However, when it gets to the clicking stage, it displays an error message:

com.automator.runner.xpc is not allowed assistive access

I've tried to give it permissions under System Preferences > Security and Privacy > Full Disk Access, but it only lets me add applications to the list, whereas this is a Quick Action (service).

tell application "System Events"
    tell process "NotificationCenter"
         click button "End" of window 1
   end tell
end tell

It should have just clicked the button, but returned the error message as given above.

Any ideas as to why this doesn't work? Is there a way for me to give com.automator.runner.xpc full disk access?

2

2 Answers

3
votes

This is a known problem with automator services that have AppleScript actions in them. I suppose Gatekeeper doesn't like them because it looks like code injection.

The workaround (until Apple does something to fix the problem) is to take the AppleScript in your action and turn it into a stand-alone AppleScript application: copy the code into Script Editor and save the file, choosing Application from the File Format menu. Add this script app to the Accessibility Security pane — System Preferences->Security & Privacy->Privacy->Accessibility — and it should pass GateKeeper's muster. Then you have a choice, depending on your setup:

  1. Create a Quick Action in Automator that calls the app.

Create a Quick Action as normal, and use the Launch Application action to run the script app. This should work as a service or as a Quick Action in the Finder preview pane

  1. Turn the script app into a service in its own right.

In the Finder, find the script app, then select "Show Package Contents" from the contextual menu. Drill down to the file "info.plist", open it in a plain-text editor and edit in a new key-value unit that looks like:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
    [...]
    <key>NSServices</key>
    <array>
        <dict>
            <key>NSBackgroundColorName</key>
            <string>background</string>
            <key>NSMenuItem</key>
            <dict>
                <key>default</key>
                <string>Service Name</string>
            </dict>
            <key>NSMessage</key>
            <string>run</string>
        </dict>
    </array>
</dict>
</plist>

... making sure not to delete or damage any of the default xml that Script Editor generates for script apps. Save the revised info.plist file, place the script app in ~/Library/Services. This only seems to work as a service (I can't get them to show up in the Extensions preference pane).

0
votes

When I simply disconnected my external monitor today I noticed that the script that I was using that triggered this alert started working. So I believe it is directly related to that.