Post

Replies

Boosts

Views

Activity

Reply to Add songs to Library in Music?
I FIGURED OUT A WORKAROUND!!! Its silly, but it works... basically you can do this with system events and the MiniPlayer... tell application "System Events" tell its process "Music" try click menu item "Add to Library" of menu "Song" of menu bar 1 on error keystroke "m" using {command down, shift down} delay 1 click menu item "Add to Library" of menu "Song" of menu bar 1 keystroke "m" using {command down, shift down} end try end tell end tell So the background for this is I have a rate/add song to playlist function which, as we all know, doesn't work when you're playing from a URL track. I have hotkeys setup through BTT to rate [⌥ + 1-5] or add to a playlist [⌥ + z] which brings up a menu to add to. Basically, my code now checks if the song is in my library via search function: tell application "Music" set searchResults to {} set cname to ctrack's name as text set cartist to ctrack's artist as text set calbum to ctrack's album as text try set searchResults to (every track of playlist "Library" whose name contains cname and artist contains cartist and album contains calbum) end try end tell return searchResults end checkInLibrary If it's not in my library, it adds it through the first function (which is probably very inefficient) then performs the rate/add to playlist functions. I REALLY HOPE THIS HELPS SOMEONE because I have been going through all of the hoops to make this work...
Oct ’22
Reply to Add songs to Library in Music?
Hi, I have come across this issue too. Something to note: I got it working yesterday (I was playing music from "Tim Jones' radio station") and the code: worked, then I restarted my MacBook, I got the error. So I would also like to stay in the loop regarding this. And also wondering why this works sometimes so I could hopefully create a workaround. ideally, im trying to write a code that allows me to add a song to a playlist, but first it checks if its in my library with a search function (or if it is URL Track), if it can't find it, it adds the track to my library first, then rates/adds to playlist. Very frustrating as well
Oct ’22