Advertisement
applehelpwriter

correct external monitor resolution

Mar 30th, 2014
390
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. -- OS X 10.9.2
  2.  
  3. --this script (c) Phil Stokes / Applehelpwriter 2014
  4. --applehelpwriter.com
  5.  
  6. (*
  7. This script automates clicking the 'Detect Displays' button in System Preferences
  8. You will need to allow access to Assistive Devices in Sys Prefs > Security settings for it to work
  9. Very useful combined with a hotkey to quickly get your external monitor resolution correct
  10. *)
  11.  
  12. try
  13.     --if sys prefs is already open, lets quit it first*
  14.     tell application "System Preferences" to quit
  15. end try
  16. delay 1
  17. tell application "System Preferences"
  18.     activate
  19.     reveal pane "com.apple.preference.displays"
  20. end tell
  21.  
  22.  
  23. tell application "System Events"
  24.     tell process "System Preferences"
  25.         set frontmost to true
  26.         try
  27.             key down option
  28.             delay 0.2
  29.             click button "Detect Displays" of window 1
  30.             delay 0.2
  31.             key up option
  32.         on error
  33.             key up option
  34.         end try
  35.     end tell
  36. end tell
  37.  
  38. tell application "System Preferences" to quit
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement