转换Applescript在Lion上运行正常但在Maverick中运行不正常

时间:2014-07-13 21:32:16

标签: applescript

tell application "System Preferences" to activate
delay 0

tell application "System Events"
    tell process "System Preferences"
        click the menu item "Universal Access" of the menu "View" of menu bar 1
        click the radio button "Seeing" of the first tab group of window "Universal Access"
        click the checkbox "Use grayscale" of tab group 1 of window "Universal Access"
    end tell
end tell
tell application "System Preferences" to quit

我曾经能够使用上面的Applescript导致屏幕灰度,直到更新到Maverick。但它不适用于发生error "System Events got an error: Can’t get menu item \"Universal Access\" of menu \"View\" of menu bar 1 of process \"System Preferences\"." number -1728 from menu item "Universal Access" of menu "View" of menu bar 1 of process "System Preferences"的Maverick。有没有人知道需要改变哪些部分才能与Maverick合作?

1 个答案:

答案 0 :(得分:1)

更改是窗格的名称,窗口的名称,没有单选按钮和选项卡组1。

试试这个脚本:

tell application "System Preferences"
    launch
    reveal anchor "Seeing_Display" of pane id "com.apple.preference.universalaccess"
end tell
tell application "System Events"
    click checkbox "Use grayscale" of window "Accessibility" of process "System Preferences"
end tell
quit application "System Preferences"