
So going off of this link, I am trying to build an AppleScript that starts/ends a Sidecar connection, and achieving this through GUI scripting the Control Center (rather than System Preferences, or by including the Screen Mirroring menu bar item). Application: Building and running in the built-in Script Editor.app.Not sure if this matters, but thought it'd be helpful to include just in case. Device: M1 MacBook Pro 13-inch (Late 2020).macOS Monterey (12.3+): This is only applicable to 12.3 or above since the method of activating/deactivating Sidecar changed a bit with the introduction of Universal Control (rather than being in the CC Display module, the button for Sidecar got moved into Screen Mirroring).
