Hi
I’m trying to write a script to turn off mirroring and switch the main screen between my laptop screen and the external screen which is either a projector or a desk monitor. I’ve figured out how to deal with the mirroring but can’t see how to toggle the main screen between my laptop and an external monitor/projector.
Here’s my script for the mirroring:
tell application "System Preferences"
set the current pane to pane id "com.apple.preference.displays"
activate
get the name of every anchor of pane id "com.apple.preference.displays"
reveal anchor "displaysArrangementTab" of pane id "com.apple.preference.displays"
tell application "System Events" to tell process "System Preferences"
get the value of checkbox "Mirror Displays" of group 1 of tab group 1 of front window
set mirrorState to the result
if mirrorState is 1 then
click checkbox "Mirror Displays" of group 1 of tab group 1 of front window
end if
end tell
end tell
Can anyone advise me how to check and then change the main screen setting?
Thanks.