-
-
Save qoli/73303f1c6c0b37e46c79d88cb79eb147 to your computer and use it in GitHub Desktop.
AppleScript to Mirror Apple TV to QuickTime
This file contains 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
set deviceName to "客廳" | |
readyQuickTime() | |
setVideoInput(deviceName) | |
on readyQuickTime() | |
tell application "QuickTime Player" | |
set newMovieRecording to new movie recording | |
delay 1 | |
end tell | |
tell application "System Events" to tell process "QuickTime Player" | |
set frontmost to true | |
end tell | |
end readyQuickTime | |
on openInputsMenu() | |
ignoring application responses | |
tell application "System Events" to tell process "QuickTime Player" | |
click button 2 of window 1 | |
delay 1 | |
end tell | |
end ignoring | |
do shell script "killall 'System Events'" | |
end openInputsMenu | |
on setVideoInput(inputName) | |
my openInputsMenu() | |
tell application "System Events" to tell process "QuickTime Player" | |
set inputMenu to menu 1 of button 2 of window 1 | |
set inputList to name of every menu item of inputMenu | |
repeat with menuItemPosition from 1 to length of inputList | |
if item menuItemPosition of inputList is inputName then | |
ignoring application responses | |
click menu item menuItemPosition of inputMenu | |
exit repeat | |
end ignoring | |
end if | |
end repeat | |
end tell | |
end setVideoInput |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment