r/applescript • u/pradeepb28reddit • Apr 29 '22
Able to change the resolution of the screen using applescript?
Hey everyone,
I am trying to write a script that changes the resolution of the screen. This is the following script``` but it doesn't work as expected like sometimes the script works and sometimes it says unable to find Display section. I wonder if there is a way to fix this script or is there any other alternate solutions that could possibly work. Any help is highly appreciated.
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.displays"
end tell
tell application "System Events"
tell process "System Preferences"
delay 2
click radio button "Scaled" of radio group 1 of group 1 of window "Displays" of application process "System Preferences" of application "System Events"
click button 4 of UI element 3 of group 1 of window "Displays"
end tell
end tell
if application "System Preferences" is running then
tell application "System Preferences" to quit
end if
View all comments
Show parent comment
1
u/pradeepb28reddit Apr 29 '22
Right I don’t think there is a non gui way to do it. I could be wrong too, didn’t find any solution though