AppleScript to Control Apple TV?

I thought I could do something like:


tell application "iTunes"

tell AirPlay device "Apple TV 4th gen"


pause

end tell

end tell


...but apparently that does not work. The script executes without error, but nothing happens on the Apple TV. Is there another way I can do this?

 Apple TV (4th generation)-OTHER, tvOS 9.2, 32GB

Posted on Mar 22, 2016 1:35 PM

Reply
4 replies

Mar 23, 2016 10:47 AM in response to stevejobsfan0123

It isn't obvious, but as far as iTunes is concerned, think of every device is an AirPlay device - including your computer, so just:


set current AirPlay devices to {AirPlay device "Computer"}


If you notice, current AirPlay devices is a list, so it's possible to have more than one output device selected, but you can't have none, which is why setting it to {} doesn't work.

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

AppleScript to Control Apple TV?

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.