不允许com.automator.runner.xpc辅助访问-运行快速操作时无法单击 [英] com.automator.runner.xpc is not allowed assistive access - cannot click when running a quick action
问题描述
我有一个快速操作,该操作运行一个AppleScript程序,需要单击一个按钮.但是,当进入点击阶段时,它会显示一条错误消息:
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不允许辅助访问
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.
关于为什么这种方法行不通的任何想法?有什么办法可以让com.automator.runner.xpc拥有完整的磁盘访问权限?
Any ideas as to why this doesn't work? Is there a way for me to give com.automator.runner.xpc full disk access?
推荐答案
这是其中包含AppleScript动作的自动服务的已知问题.我想Gatekeeper不喜欢它们,因为它看起来像代码注入.
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.
解决方法(直到Apple采取措施解决问题为止)是将AppleScript用作您的操作并将其转换为独立的AppleScript应用程序:将代码复制到脚本编辑器中并保存文件,然后选择 Application (来自文件格式菜单).将此脚本应用程序添加到可访问性安全性"窗格中-系统偏好设置"->安全性"和安全性".隐私->隐私->可访问性-它应该通过GateKeeper的要求.然后,您可以根据自己的设置进行选择:
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:
- 在Automator中创建一个调用该应用的快速操作.
照常创建一个快速操作,然后使用启动应用程序"操作来运行脚本应用程序.这应该作为服务或在Finder预览窗格中的快速操作
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
- 将脚本应用本身转换为服务.
在Finder中,找到脚本应用,然后从上下文菜单中选择显示包内容".向下钻取到"info.plist"文件,在纯文本编辑器中将其打开,然后在新的键值单元中进行编辑,如下所示:
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>
...确保不删除或损坏脚本编辑器为脚本应用生成的任何默认xml.保存修改后的info.plist文件,将脚本应用程序放置在〜/Library/Services中.这似乎只能作为服务使用(我无法让它们显示在扩展程序"首选项窗格中.)
... 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).
这篇关于不允许com.automator.runner.xpc辅助访问-运行快速操作时无法单击的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!