如果选择了另一个单选按钮,我想单击“系统偏好设置”中的单选按钮,如下所示:
tell application "System Preferences"
activate
end tell
tell application "System Events"
tell process "System Preferences"
click menu item "Mouse" of menu "View" of menu bar 1
if radio button "Right" is selected <-- pseudo-code
tell window "Mouse"
tell radio group 1
click radio button "Left"
end tell
end tell
end if
if radio button "Left" is selected <-- pseudo-code
tell window "Mouse"
tell radio group 1
click radio button "Right"
end tell
end tell
end if
end tell
end tell
谁知道怎么做?
答案 0 :(得分:1)
如果主按钮当前设置为“Right”,则以下脚本会将主按钮恢复为“Left”:
tell application "System Preferences"
activate
set current pane to pane id "com.apple.preference.mouse"
end tell
tell application "System Events"
tell process "System Preferences"
tell radio group "Primary mouse button:" of window "Mouse"
if value of radio button "Right" is 1 then
click radio button "Left"
end if
end tell
end tell
end tell
将主按钮设置为“正确”会让大多数用户感到困惑。