Automation 脚本化;系统首选项“&引用;语文及;“文本”;
我需要使用applescript更改系统首选项|语言和文本部分中的列表框“区域”。我无法访问此列表框-请参阅下面的代码Automation 脚本化;系统首选项“&引用;语文及;“文本”;,automation,applescript,Automation,Applescript,我需要使用applescript更改系统首选项|语言和文本部分中的列表框“区域”。我无法访问此列表框-请参阅下面的代码 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
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
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