Advertisement
GeertCu

OSX SwitchResolution

Jul 7th, 2016
273
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. local index1, index2
  2.  
  3. set index1 to 3 -- 1440 x 900 (Best for Retina)
  4. set index2 to 5 -- 1920 x 1200 (More Space)
  5.  
  6. -- Launch "System Preferences", open the "Displays" options and change to the "Display" tab
  7. tell application "System Preferences"
  8.     --activate
  9.     set the current pane to pane id "com.apple.preference.displays"
  10.     reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
  11. end tell
  12.  
  13. local indexToUse
  14.  
  15. -- Now lets make the necessary changes
  16. tell application "System Preferences"
  17.     reveal anchor "displaysDisplayTab" of pane "com.apple.preference.displays"
  18. end tell
  19.  
  20.  
  21. tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
  22.     click radio button "Display" of tab group 1
  23.     click radio button "Scaled" of radio group 1 of tab group 1
  24.     tell radio group 1 of group 1 of tab group 1
  25.         set isRetinaOptimized to get value of radio button 3
  26.     end tell
  27.     if isRetinaOptimized then
  28.         click radio button 5 of radio group 1 of group 1 of tab group 1
  29.     else
  30.         click radio button 3 of radio group 1 of group 1 of tab group 1
  31.     end if
  32. end tell
  33. quit application "System Preferences"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement