mail@pastecode.io avatar
2 months ago
849 B
tell application "System Events"
    tell process "ControlCenter"
        -- Attempt to open the Control Center. This might vary based on your macOS version.
        click (first menu bar item of menu bar 1 whose description is "control center")
        delay 1 -- Wait for the Control Center to open
        -- Navigate to the Screen Mirroring menu. The description could be different based on your system language or macOS version.
        click (first button of group 1 of window "Control Center" whose description is "Screen Mirroring")
        delay 1 -- Wait for the Screen Mirroring options to show up
        -- Select your Apple TV. Replace 'Living Room TV' with the exact name of your Apple TV.
        click (first button of scroll area 1 of window "Control Center" whose name is "Living Room TV")
    end tell
end tell
Leave a Comment