【发布时间】:2021-11-02 15:16:40
【问题描述】:
我对 AppleScript 很陌生,这是我的第一个脚本。我正在尝试通过一个应用程序启动 GeoGuessr 并将用户代理更改为谷歌浏览器(因为默认的那个确实是错误的)
这是我的代码
tell application "Safari" to activate
tell application "Safari"
tell front window
set current tab to (make new tab with properties {URL:"https://geoguessr.com"})
end tell
end tell
tell application "System Events"
tell process "Safari"
click menu item "Google Chrome — MacOS" of menu "User Agent" of menu item "User Agent" of menu "Develop" of menu bar item "Develop" of menu bar 1
end tell
end tell
当我通过脚本编辑器启动它时,它会工作并将用户代理更改为 chrome。但是当我通过应用程序本身运行它时,它给了我这个错误。
System Events got an error: GeoGuessr is not allowed assistive access. (-1719)
每次我去检查设置中的权限时,我的应用旁边的小框都不再打勾了。为什么会这样?
【问题讨论】:
-
正如我所说,我勾选了该框。当我打开应用程序时它会自动取消
-
这就是应用程序的全部内容吗?是代码签名的吗?请注意,AppleScript 过去通过修改脚本文件来保存全局属性和变量,这可以更改可访问性。
-
我没有对代码做任何其他事情,所以我认为它没有签名。我该如何检查?这就是应用程序的全部内容,我基本上复制粘贴了 2 个不同的脚本并尝试将它们放在一起以创建我需要的内容
标签: macos applescript