Reputation: 11
I want to use an Applescript to set my Mac screen resolution to "Scaled", "Larger text".
I found the stackoverflow script below which works great to select the 2nd scaled resolution button. However, I would like to select the 1st, "Larger text". That resolution requires an OK button click which I don't know how to do.
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane
"com.apple.preference.displays"
end tell
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
click radio button "Scaled" of radio group 1 of tab group 1
click radio button 2 of radio group 1 of group 1 of tab group 1
end tell
quit application "System Preferences"
I changed button 2 to button 1, but there was no change in the resolution.
Thanks for your help.
Upvotes: 1
Views: 1772
Reputation: 321
I wrote a command line util called displayplacer that makes this super easy - especially for multi-monitor setups. For example, I can set my MacBook Pro to Larger Text by executing displayplacer "id:F466F621-B5FA-04A0-0800-CFA6C258DECD res:1024x640 scaling:on origin:(-1024,1060) degree:0"
Also available via Homebrew: brew tap jakehilborn/jakehilborn && brew install displayplacer
Upvotes: 2
Reputation: 3142
This AppleScript code works for me using the latest version of macOS Mojave.
tell application "System Events" to tell process "System Preferences" to tell window "Built-in Retina Display"
click radio button "Scaled" of radio group 1 of tab group 1
click radio button 1 of radio group 1 of group 2 of tab group 1
delay 0.1 -- May Need To Adjust
try
click button "OK" of sheet 1
end try
end tell
quit application "System Preferences"
Upvotes: 0