Looks like no one’s replied in a while. To start the conversation again, simply ask a new question.

Playing a Playlist, then moving to another Playlist

Hi,

I'd like iTunes to play a certain playlist at a specific time (which I know can be done w/ iCal) but when iTunes is finished playing everything in Playlist A, I'd like it to start playing Playlist B.


To start with I'll use this, which will start the playlist

tellapplication "iTunes"

play playlist "Playlist A"

end tell


I believe this counts the amount of tracks in the playlist:

set thisPlaylist to the current playlist

set totalTracks to the count of tracks of thisPlaylist

how can I tie them together and get it to move onto the next playlist.

Any suggestions would be greatly appreciated.


Thanks

Posted on Nov 19, 2015 5:51 AM

Reply
Question marked as Best reply

Posted on Nov 19, 2015 6:18 AM

Hi,


Check out the properties of playlists in iTunes' AppleScript dictionary. One of them is duration, which returns the length of the playlist in seconds.


At a very basic level, you can retrieve that duration, tell the script to wait for that length of time (plus a bit longer perhaps) while it's playing the first playlist, and then play the next one:


tell application "iTunes"

set a_time to duration of playlist "A"

play playlist "A"

delay (a_time + 5)

play playlist "B"

end tell


However, you may want to build in something that will stop the second playlist kicking in even if you deliberately quit iTunes halfway through the first playlist.


Hope this helps,


H

2 replies
Question marked as Best reply

Nov 19, 2015 6:18 AM in response to DJ Bonus

Hi,


Check out the properties of playlists in iTunes' AppleScript dictionary. One of them is duration, which returns the length of the playlist in seconds.


At a very basic level, you can retrieve that duration, tell the script to wait for that length of time (plus a bit longer perhaps) while it's playing the first playlist, and then play the next one:


tell application "iTunes"

set a_time to duration of playlist "A"

play playlist "A"

delay (a_time + 5)

play playlist "B"

end tell


However, you may want to build in something that will stop the second playlist kicking in even if you deliberately quit iTunes halfway through the first playlist.


Hope this helps,


H

Playing a Playlist, then moving to another Playlist

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple ID.