AppleScript:如何识别系统偏好设置中的复选框位置?
AppleScript: How to identify checkbox location in System Preferences?
我想发出键盘命令来切换 OS X
中 "Change picture every 30 minutes" 的复选框 Desktop 1
(我的主显示器桌面)。我有多个显示器,因此可能需要确定要操作的特定首选项面板。
我已经设置了 AppleScript 的开头,但我不知道如何制定如何识别这个特定的复选框:
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click menu item "Desktop & Screen Saver" of menu "View" of menu bar 1
delay 2
tell window "Desktop & Screen Saver"
click checkbox 1 of …
它在 tab group 1
。您可以借助 Xcode 工具辅助功能检查器(Xcode > 打开开发者工具 > 菜单栏或 Dock 中的辅助功能检查器)识别这一点。
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.desktopscreeneffect"
end tell
delay 2
tell application "System Events" to tell process "System Preferences"
click checkbox "Change picture:" of tab group 1 of window "Desktop & Screen Saver"
end tell
我想发出键盘命令来切换 OS X
中 "Change picture every 30 minutes" 的复选框 Desktop 1
(我的主显示器桌面)。我有多个显示器,因此可能需要确定要操作的特定首选项面板。
我已经设置了 AppleScript 的开头,但我不知道如何制定如何识别这个特定的复选框:
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click menu item "Desktop & Screen Saver" of menu "View" of menu bar 1
delay 2
tell window "Desktop & Screen Saver"
click checkbox 1 of …
它在 tab group 1
。您可以借助 Xcode 工具辅助功能检查器(Xcode > 打开开发者工具 > 菜单栏或 Dock 中的辅助功能检查器)识别这一点。
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.desktopscreeneffect"
end tell
delay 2
tell application "System Events" to tell process "System Preferences"
click checkbox "Change picture:" of tab group 1 of window "Desktop & Screen Saver"
end tell