Created
June 26, 2021 01:32
-
-
Save assimilat/7351515f09d747c2f7e8238ca7966dd4 to your computer and use it in GitHub Desktop.
Toggles screen mirroring to the airplay device named "Bedroom"
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
tell application "System Preferences" | |
quit | |
end tell | |
tell application "System Preferences" | |
activate | |
set the current pane to pane id "com.apple.preference.displays" | |
tell application "System Events" | |
delay 1 | |
set window_name to name of first window of (first application process whose frontmost is true) | |
get window_name | |
tell pop up button 1 of window window_name of application process "System Preferences" | |
delay 0.5 | |
set current_display to value | |
click | |
delay 0.5 | |
if current_display = "Off" then | |
click menu item "Bedroom" of menu 1 | |
delay 10 | |
else | |
click menu item "Off" of menu 1 | |
delay 5 | |
end if | |
end tell | |
end tell | |
end tell | |
tell application "System Preferences" | |
quit | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment