我需要在系统首选项|语言&中使用applescript更改列表框“region”。文字部分。我无法访问此列表框 - 请参阅下面的代码。
tell application "System Preferences"
activate
get the name of every pane of application "System Preferences"
set the current pane to pane id "com.apple.Localization"
get the name of every anchor of pane id "com.apple.Localization"
reveal anchor "Formats" of pane id "com.apple.Localization"
end tell
答案 0 :(得分:2)
GUI脚本编写总是一个挑战,而且并不总是可靠的,但是你去了
tell application "System Preferences"
activate
get the name of every pane of application "System Preferences"
set the current pane to pane id "com.apple.Localization"
get the name of every anchor of pane id "com.apple.Localization"
reveal anchor "Formats" of pane id "com.apple.Localization"
end tell
tell application "System Events"
tell application process "System Preferences"
click pop up button 1 of tab group 1 of window 1
repeat 23 times
keystroke (ASCII character 30) -- got to the top
end repeat
repeat 21 times
keystroke (ASCII character 31) -- down to second to last
end repeat
keystroke return
end tell
end tell