Created
January 22, 2016 19:12
-
-
Save n8henrie/4ba1780d6b3673a061af to your computer and use it in GitHub Desktop.
UI Script to click the "detect displays" button in System Preferences on OS X 10.11 El Capitan
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-- Minimally modified from: | |
-- http://www.insanelymac.com/forum/topic/59163-detect-displays-by-command-or-script/?p=457644 | |
activate application "System Preferences" | |
tell application "System Events" | |
tell application process "System Preferences" | |
tell window 1 | |
click button "Show All" of group 1 of group 2 of toolbar 1 (* in case another pane is already open *) | |
tell button "Displays" of scroll area 1 | |
repeat until exists (* wait until the object is accessible *) | |
delay 0.2 | |
end repeat | |
click | |
end tell | |
tell button "Detect Displays" | |
repeat until exists (* wait until the object is accessible *) | |
key down option | |
delay 0.2 | |
end repeat | |
click | |
key up option | |
end tell | |
end tell | |
end tell | |
end tell | |
tell application "System Preferences" to quit |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment