Unable to read object properties with AppleScript: “Music got an error: Can’t get properties of current track.”

apple.stackexchange https://apple.stackexchange.com/questions/412646

  •  31-05-2021
  •  | 
  •  

Question

I am trying to write an AppleScript that will tell me the current playing song, but I am unable to read properties from objects in AppleScript.

Executing a function on music works fine such as

tell application "Music" to play
tell application "Music" to pause

But trying to read a property such as the current track title does not. In fact, even trying to read the properties of the current track does not work. (Tested while a song was playing)

tell application "Music" to get properties of current track

returns error "Music got an error: Can’t get properties of current track." number -1728 from properties of current track

Per this question, the above script should work: AppleScript and Music

I did get this to work when I was trying before when I was looking at the permissions, but then it stopped working since then so it might have been working for another reason. I'm running the script in script editor, which does have accessibility access in my security & privacy settings.

Possibly related issue: Applescript - Getting Property of an Object Not Working

Was it helpful?

Solution

I'll summarize the discussion here:

  1. current track for streaming songs is broken in big sur, refer here
  2. current track only works for local files, refer to @user3439894 and here

And I had verify that if you download the songs in Music and then play it, you can successfully get the info.

Licensed under: CC-BY-SA with attribution
Not affiliated with apple.stackexchange
scroll top