Skip to content

Instantly share code, notes, and snippets.

@digiltd
Last active March 11, 2016 01:33
Show Gist options
  • Select an option

  • Save digiltd/eff52da23a62c998b658 to your computer and use it in GitHub Desktop.

Select an option

Save digiltd/eff52da23a62c998b658 to your computer and use it in GitHub Desktop.
Detect displays with a not very elegant AppleScript macro
tell application "System Preferences"
activate
reveal pane "com.apple.preference.displays"
end tell
delay 0.5
tell application "System Events"
tell process "System Preferences"
try --don't even consider not using a try block!
key down option
delay 0.2
click button "Detect Displays" of window 1
delay 0.2
key up option
on error --logging out is the only other way to clear these
key up option
end try
end tell
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment