2010-10-31 100 views
0

我需要在系统首选项|语言&文本部分中使用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 name of every anchor of pane id "com.apple.Localization" 
    reveal anchor "Formats" of pane id "com.apple.Localization" 
end tell 

回答

2

GUI脚本始终是一个挑战IAND并不总是可靠的,但在这里你去

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 
+0

这正是我需要的,谢谢。 – jbastos 2010-11-02 00:40:05