Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
Change screen resolution using Applescript works on 10.10 non-rentia macbook
-- 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 indexToUse
-- Now lets make the necessary changes
tell application "System Events"
tell tab group 1 of window "SyncMaster" of application process "System Preferences" of application "System Events"
tell radio group 1
if (value of radio button "Scaled") = 0 then
-- Click the "Scaled" radio button
click radio button "Scaled"
tell table 1 of scroll area 1 of tab group 1 of window "SyncMaster" of application process "System Preferences" of application "System Events"
select row 4
end tell
else
click radio button "Default for display"
end if
end tell
end tell
end tell
-- Quit "System Preferences"
quit application "System Preferences"
@TheCatCoder

This comment has been minimized.

Copy link

commented Apr 27, 2017

Thanks so much for making this! It works great, except I need to access a resolution that only shows in the hidden "option" menu.

So is there any way of making the mouse click the "Scaled" button with the option key held down, so that the hidden resolutions show up?

@jakehilborn

This comment has been minimized.

Copy link

commented May 18, 2019

@TheCatCoder I wrote a command line tool, displayplacer, that lets you programmatically change screen resolutions - including the hidden scaled ones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.