macos - 应用程序在启动时被移除辅助访问
问题描述
我对 AppleScript 真的很陌生,这是我的第一个脚本。我正在尝试通过一个应用程序启动 GeoGuessr 并将用户代理更改为 Google Chrome(因为默认的那个确实是错误的)
这是我的代码
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)
每次我去检查设置中的权限时,我的应用程序旁边的小框都不再打勾了。为什么这样做?
解决方案
转到系统偏好设置-> 安全和隐私->可访问性。
您的应用程序应该在允许控制计算机的应用程序列表中。
现在,存在 2 种情况可以进一步推进:
a)您的应用程序的复选框未选中。在这种情况下,只需检查它。
b)您的应用程序的复选框已选中(但不像您说的那样工作)。在这种情况下,从列表中删除您的应用程序,使用减号按钮,重新启动您的应用程序,再次执行步骤 a)。
推荐阅读
- c - C 错误:无法将 'pile {aka pp}' 转换为 'pile** {aka pp**}
- ssl - 安全连接失败 - ColdFusion 2018
- javascript - 从变量 HTML 结果中解析特定字符串
- r - 将子集转换为前缀版本以使用管道
- amazon-web-services - 将 Cloudflare 配置为指向 AWS Amplify
- android - 更喜欢 AndroidInjector.Factory 现在组件可以有工厂而不是构建器
- angular - 将值更改为作为@input 属性接收的属性 - Angular 7
- java - HashMap 代码不起作用,因为不能应用于给定类型
- security - 研究计算机安全,从哪里开始
- spring - 具有 spring-security 和 webflux 公共模式的过滤器链