How to get name of playlists contained in folder playlist in iTunes? I am only able to get tracks.
Hi chris2, Try this…
property buildlist : {}
property thebadlists : {"Library", "Purchased Music"}
global theList
on run
set buildlist to {}
getplaylists() of me
setupchoices() of me
choosetheplaylist() of me
end run
on getplaylists()
tell application "iTunes"
set theList to (name of every playlist)
end tell
end getplaylists
on setupchoices()
repeat with everyitem in theList
set thisplaylist to (everyitem as string)
if (thisplaylist) is not in (thebadlists) then
copy (thisplaylist as string) to end of buildlist
end if
end repeat
end setupchoices
on choosetheplaylist()
activate
choose from list buildlist with prompt "Select what want to listen to..."
set chosenlist to result as string
if chosenlist is not equal to "false" then
playthisone(chosenlist) of me
end if
end choosetheplaylist
on playthisone(letsgo)
tell application "iTunes"
play track 1 of playlist letsgo
end tell
tell application "iTunes"
activate
delay 0.5
tell application "System Events" to set visible of process "iTunes" to false
end tell
end playthisone
Tom
Hi,
the folder user playlists contains playlists and folder playlists.
The property parent specifies the parent folder.
As the whose filter doesn’t work, you must retrieve the names with a repeat loop
set theNames to {}
tell application "iTunes"
repeat with aPlaylist in (get every user playlist)
try
set p to parent of aPlaylist
if name of p is "testFolderPlaylist" then
set end of theNames to name of aPlaylist
end if
end try
end repeat
end tell
theNames
Thanks Tom and StefanK.
iTunes is so scriptable that I am surprised there is no direct way to get names of playlist contained in a folder playlist.
The problem with the script posted by StefanK is that if I want to find playlists contained in one folder playlist, parents of all the playlists have to be called. It slows me down in what I was trying to achieve.