Skip to content

Instantly share code, notes, and snippets.

@SwampDragons
Last active January 2, 2016 13:19
Show Gist options
  • Save SwampDragons/8308893 to your computer and use it in GitHub Desktop.
Save SwampDragons/8308893 to your computer and use it in GitHub Desktop.
on getwhat(what)
set options to {res1920_1200:1, res1680_1050:2, res1600_1200:3, res1400_1050:4, res1400_900:5, res1376_1032:6, res1280_1024:7, res1280_800:8, res1152_900:9, res1152_864:10, res1024_768:11}
set s to "on run {options}" & return
set s to s & "get " & what & " of options" & return
set s to s & "end"
run script s with parameters {options}
end getwhat
on run argv
set myres to item 1 of argv
set myrow to getwhat(myres)
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events"
--Ensures window is on Display tab, not Color tab
click radio button "Display" of tab group 1 of window 1 of process "System Preferences"
click radio button "Scaled" of tab group 1 of window 1 of process "System Preferences"
UI element of table 1 of scroll area 1 of tab group 1 of window 1 of process "System Preferences"
select row myrow of table 1 of scroll area 1 of tab group 1 of window 1 of process "System Preferences"
end tell
tell application "System Preferences"
quit
end tell
end run
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment