AppleScript: How to add currently-playing Apple Music song to a playlist? I've got a little AppleScript in Alfred that marks the currently-playing song as "Loved", it looks like this:

tell application "iTunes"
    set loved of current track to true
end tell


This script works great.

But! I'd like it to do one more thing, and it's not working: I'd like to add the track to a playlist called "Loved". Here's v2 of the script:

tell application "iTunes"
    set loved of current track to true
    duplicate current track to playlist "Loved"
end tell


This way, I'd have a way to find these tracks later (for example, I listen to Radio a lot, and would love to find those Favorites later on).

Here is the error message that AppleScript shows me when I run v2:

"iTunes got an error: Can only duplicate subscription tracks to library source."

Any ideas if there is a way to accomplish this? 

A few caveats:


I'd like to avoid adding the track to my Library.
If there's a way to have a Smart Playlist that contains all songs that I've Loved (even those not in my Library), then great! As far as I can tell, though, that's not possible with Smart Playlists.
I've been cracking my head on this one as well and currently, there doesn't seem to be any way to add Apple Music tracks to a playlist. It's kinda unintuitive that there isn't a default way in AM to access all loved songs, but here we are. AM is getting better surely but slowely, so fingers crossed.

What I've done as a workaround in the meantime, is added a functionality that saves the song into a text file that is synced to iCloud. That way I can manually enter the songs whenever I have some time to spare and I can do it both on my iMac and Macbook.

tell application "iTunes"
    set loved of current track to true
    set songname to current track's name
    set songartist to current track's artist
    set textpath to "~/Library/Mobile\\ Documents/com~apple~CloudDocs/AppleMusicToDo.txt"

    do shell script "echo " &amp; quoted form of songartist &amp; " - " &amp; quoted form of songname &amp; " &gt;&gt; " &amp; textpath

end tell