如何使用AppleScript导航到辅助功能设置中的鼠标和触控板?


0

我使用辅助功能检查器试图帮助我解决这个问题,但我无法得到它。我正在导航到“辅助功能”面板,但之后我无法导航到鼠标和放大器。触控板或任何其他菜单项。

tell application "System Preferences"
    set current pane to pane "com.apple.preference.universalaccess"
end tell
tell application "System Events" to tell process "System Preferences"

    -- part that I am having trouble with
    tell table 1 of scroll area 1 of window 1
    select row 1
    end tell

end tell

What the actual GUI looks like

This is just some of the info that the Accessibility Inspector gave me


您要更改哪些设置?也许更容易确定哪些.plist文件需要使用 defaults write terminal命令更改设置,而不是计算GUI界面的脚本。 〜/ Library / Preferences中的一些plist文件嫌疑人: com.apple.AppleMultitouchTrackpad, com.apple.AppleMultitouchMouse, com.apple.driver.AppleBluetoothMultitouch.mouse, com.apple.driver.AppleBluetoothMultitouch.trackpad, com.apple.preference.trackpad。您可以使用以下命令查看可以更改的设置 defaults read 终端命令。
— IconDaemon

Answers:


2

您不需要UI脚本就可以执行此操作。系统偏好设置有一个applescript字典,允许您打开特定的首选项屏幕(窗格)和表格中的特定项目(锚点)。

tell application "System Preferences"
    reveal anchor "Mouse" of pane id "com.apple.preference.universalaccess"
    activate
end tell

将打开鼠标和触控板部分。我通过查看系统偏好设置的AppleScript字典找到了这个,有些谷歌搜索带我去了 使用这些命令的优秀讨论 。


虽然这确实打开了鼠标的系统偏好设置。在辅助功能下的触控板窗口没有焦点,可以在其他窗口后面。我补充一下 activate 之后 reveal anchor ... 线。
— user3439894

好点。我补充说。
— Alan Shutko
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.