Skip to content

Instantly share code, notes, and snippets.

@iandol
Created May 17, 2018 01:40
Show Gist options
  • Save iandol/44e5a51135e5bd0178d5ec511570c19c to your computer and use it in GitHub Desktop.
Save iandol/44e5a51135e5bd0178d5ec511570c19c to your computer and use it in GitHub Desktop.
Applescript to toggle Retina Scale mode
-- Launch "System Preferences", open the "Displays" options and change to the "Display" tab
tell application "System Preferences"
activate
set the current pane to pane id "com.apple.preference.displays"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
local index1, index2, index3, indexToUse
set index1 to 3
set index2 to 4
set index3 to 5
-- Now lets make the necessary changes
tell application "System Events"
delay 0.2
tell window "Built-in Retina Display" of application process "System Preferences" of application "System Events"
delay 0.2
tell radio group 1 of tab group 1
click radio button "Scaled"
end tell
delay 0.2
tell radio group 1 of group 1 of tab group 1
if (value of radio button index1) is true then
set indexToUse to index2
else if (value of radio button index2) is true then
set indexToUse to index3
else if (value of radio button index3) is true then
set indexToUse to index1
else
set indexToUse to index1
end if
click radio button indexToUse
end tell
--get entire contents
end tell
end tell
tell application "System Preferences"
quit
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment