Hi, I’m still looking for a little advice. Please help if you can.
I need to set the display preferences to a particular display resolution and have it rotated 90 degrees at startup. Do I need a script for this/can I use one?
I figured that the computer should start up to whatever display preferences it was shut down with, but that doesn’t seem to be the case.
I appreciate any help at all that you can give. Thanks!
I don’t own a display for which rotation by 90 degrees is a possibility, but certainly on my machine the settings I leave in System Preferences > Displays “stick”. So should yours.
normally the display settings won’t be changed at startup, so something might go wrong on your machine.
Anyway, to change the display resolution is no problem with the CLI cscreen, but it cannot perform the rotation.
The only way to do this (as far as I know) is to use GUI scripting like this
tell application "System Preferences"
reveal anchor "displaysDisplayTab" of pane id "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
tell window 1
tell pop up button 3 of group 1 of tab group 1
click
click menu item 2 of menu 1 -- select 90° rotation
end tell
repeat until exists sheet 1
delay 0.5
end repeat
click button "Confirm" of sheet 1
end tell
end tell
end tell
quit application "System Preferences"