【发布时间】:2021-03-15 20:42:56
【问题描述】:
我的最终目标是单击“启用切换控制”复选框,该复选框可以在“系统偏好设置”的“辅助功能”->“切换控制”下找到。我在让 applescript 工作时遇到了一些麻烦,我想找出导致问题的原因。 我当前的代码:
if running of application "System Preferences" then
quit application "System Preferences"
delay 1
end if
tell application "System Preferences"
reveal anchor "Switch" of pane id "com.apple.preference.universalaccess"
activate
end tell
我通过以下方式获得了锚开关:
tell application "System Preferences"
get anchors of pane id "com.apple.preference.universalaccess"
end tell
它返回了所有可用的锚点。这是一个sn-p:
...窗格 ID com.apple.preference.universalaccess 的锚 TextToSpeech,窗格 ID com.apple.preference.universalaccess 的锚 Dwell,锚 窗格 ID com.apple.preference.universalaccess 的听写,窗格 ID com.apple.preference.universalaccess 的锚点 切换,窗格 ID com 的锚点 Siri。 apple.preference.universalaccess...
我尝试使用其他锚点(听写、Siri 等)测试 AppleScript,它们都有效(将我引导到预期区域),但 Switch 没有。我什至尝试用其数值reveal anchor 11 of pane id "com.apple.preference.universalaccess" 替换“Switch”,但这也失败了。这是为什么?另外,我将如何修改 applescript 以获得预期的结果?
【问题讨论】:
标签: macos applescript