监视系统首选项中的下拉列表

时间:2012-09-10 17:02:55

标签: applescript system-preferences

tell application "System Events"
tell application "System Preferences"
    activate
    set current pane to pane "com.apple.preference.displays"
    set theWindows to windows
    set win2 to item 2 of theWindows
    tell win2
        set index to 1
        set visible to false
        set visible to true
    end tell
    set value of combo box 1 to "90°"
end tell
end tell

我正在尝试通过Applescript更改外部屏幕的旋转,但我确实如此 找不到如何访问此下拉菜单。 Google似乎给了我很多关于组合框和弹出菜单的信息,但在Lion下,至少所有这些东西都不起作用。

1 个答案:

答案 0 :(得分:0)

这对我来说是在10.8。

tell application "System Preferences"
    reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences"
    tell pop up button 1 of tab group 1 of window 1
        click
        click menu item 3 of menu 1
    end tell
end tell