Skip to content

Instantly share code, notes, and snippets.

@erdemkosk
Created June 1, 2024 21:11
Show Gist options
  • Save erdemkosk/4a603845bd30b3a0e1ba341411904aff to your computer and use it in GitHub Desktop.
Save erdemkosk/4a603845bd30b3a0e1ba341411904aff to your computer and use it in GitHub Desktop.
Macos Sonoma Sidecar Script
do shell script "open -b com.apple.systempreferences /System/Library/PreferencePanes/Displays.prefPane"
use AppleScript version "2.4"
set iPadName to "Mekpad"
tell application "System Events"
repeat until (exists window "Displays" of application process "System Settings")
delay 0.1
end repeat
tell process "System Settings"
tell pop up button 1 of group 1 of group 2 of splitter group 1 of group 1 of window "Displays"
click
delay 0.1
tell (last menu item of menu 1 whose name contains iPadName)
click it
delay 3
end tell
end tell
end tell
end tell
tell application "System Settings" to quit
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment