当我将外接显示器插入我的Macbook并唤醒它时,显示屏通常会出现错误的分辨率。在Mountain Lion之前,我可以运行以下AppleScript来检测显示器:
tell application "System Preferences" to activate
tell application "System Events"
tell process "System Preferences"
click menu item "Displays" of menu "View" of menu bar 1
tell button "Detect Displays" of window 1 to click
end tell
end tell
tell application "System Preferences" to quit
但是,在10.8版本中,“检测显示器”按钮需要按下Option键才能显示出来,因此脚本会出现以下错误:
我的苹果脚本技能非常基础,而且我在谷歌上也没有找到答案。 我该如何修改脚本以单击现在隐藏的“检测显示器”按钮?error "System Events got an error: Can’t get button \"Detect Displays\" of window 1 of process \"System Preferences\"." number -1728 from button "Detect Displays" of window 1 of process "System Preferences"