reiterating over a playlist
reiterating over a playlist
- Subject: reiterating over a playlist
- From: iKel via AppleScript-Users <email@hidden>
- Date: Sat, 18 Apr 2020 16:40:09 -0500
Hello!
I am trying to iterate over a playlist and this is what I have thus far. I
cannot seem to get it down. Maybe this is
not the best way to do it but what I am trying to do is to a iterate over a
playlist and get both the artist and song
separated by the word “by”.
something like this:
song by artist
song by artist
song by artist
what I can get is all the songs and all the artist as a list but just trying to
get the artist aligned with the appropriate song
separated with the word “by”. If there is a better solution or if I’m on the
right track any help would much appreciated.
Thanks to all in advance!
tell application "Music"
tell playlist "Today at Apple"
set trackItems to (get the name of every track)
set thisArtist to (get artist of every track)
repeat with i from 1 to count of trackItems
set songItem to item i of trackItems
end repeat
end tell
end tell
set songsInPlaylist to songItem as string
set artistInPlaylist to thisArtist as string
tell application "TextEdit"
activate
make new document with properties {name:"Today at Apple"}
set text of document 1 to the songsInPlaylist & artistInPlaylist
end tell
I’m running Catalina (Version 10.15.4)
Thanks again!
Sent from my iPhone
Live your life as an exclamation rather than an explanation. -Sir Isaac Newton
iKel
email@hidden
_______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users
This email sent to email@hidden