You can make a difference in the Apple Support Community!

When you sign up with your Apple Account, you can provide valuable feedback to other community members by upvoting helpful replies and User Tips.

Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Please point me toward some AppleScript Source code examples for macOS TV.app

After making the leap to Catalina, all my old iTunes AppleScripts are non functional.

I can find no source code examples of Catalina specific AppleScripts. All the examples are for older versions of macOS which use the iTunes application rather than the new media applications of Music and TV.


The majority of these old scripts were tinkered together after looking at source code examples posted online by various other developers. I am hoping to find newer source code examples so that I can update my scripts.

iMac 27", macOS 10.15

Posted on May 5, 2020 7:31 PM

Reply
Question marked as Top-ranking reply

Posted on May 6, 2020 6:21 AM

Dan White wrote:

After making the leap to Catalina, all my old iTunes AppleScripts are non functional.
I can find no source code examples of Catalina specific AppleScripts. All the examples are for older versions of macOS which use the iTunes application rather than the new media applications of Music and TV.

The majority of these old scripts were tinkered together after looking at source code examples posted online by various other developers. I am hoping to find newer source code examples so that I can update my scripts.



Script Editor User Guide for Mac - Apple Support


Apple TV app on Mac at a glance - Apple Support


Apple TV App User Guide for Mac - Apple Support


Manage your library in the Apple TV app on Mac - Apple Support



2 replies
Question marked as Top-ranking reply

May 6, 2020 6:21 AM in response to Dan White

Dan White wrote:

After making the leap to Catalina, all my old iTunes AppleScripts are non functional.
I can find no source code examples of Catalina specific AppleScripts. All the examples are for older versions of macOS which use the iTunes application rather than the new media applications of Music and TV.

The majority of these old scripts were tinkered together after looking at source code examples posted online by various other developers. I am hoping to find newer source code examples so that I can update my scripts.



Script Editor User Guide for Mac - Apple Support


Apple TV app on Mac at a glance - Apple Support


Apple TV App User Guide for Mac - Apple Support


Manage your library in the Apple TV app on Mac - Apple Support



May 7, 2020 6:25 AM in response to leroydouglas

These links were not 100% helpful.

However, I pushed through the Script Editor's Guide and bumped into the Log History window - Window --> Log History

Keyboard Shortcut Command-Option L


That window provided the debugging details I needed to see what I was messing up on.


So here is a sample script that works on Catalina :


tell application "TV"
	activate
	
	try
		set sel to selection
		if sel is not {} then
			repeat with aTrack in sel
				display dialog "Name: " & (name of aTrack) ¬
					giving up after 5
			end repeat
		else
			display dialog return & "No tracks are selected..." buttons {"Cancel"} ¬
				default button 1 with icon 0 giving up after 5
			return
		end if
	end try
end tell

Please point me toward some AppleScript Source code examples for macOS TV.app

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