Created
July 3, 2022 09:57
-
-
Save chatchavan/6e60982b80b96a3be155023a5afe8d30 to your computer and use it in GitHub Desktop.
Toggle iPad Sidecar display (Tested on Monterrey 12.4)
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use AppleScript version "2.4" | |
set iPadName to "ChatPad" -- TODO: Change to the name of your iPad | |
tell application "System Preferences" to activate | |
tell application "System Preferences" | |
reveal pane id "com.apple.preference.displays" | |
end tell | |
tell application "System Events" | |
tell process "System Preferences" | |
delay 0.8 | |
click window "Displays" | |
tell pop up button "Add Display" of window "Displays" | |
click | |
delay 0.8 | |
tell (last menu item of menu 1 whose name contains "ChatPad") | |
click it | |
end tell | |
end tell | |
end tell | |
end tell | |
tell application "System Preferences" to close window 1 |
Just tested it today, and it works on my mac (Monterey 12.5).
Check if the system preference window shows up. If not, try adding "delay 0.8" at line 10.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Can't get window "Displays" of process "System Preferences"