Is it possible to create a script that will alternate the playlist that it calls up in iTunes? Look at the script below–I’d like it to alternate between playing one of 3 different playlists every time it runs (such as playlist 1 the first time it runs, then if it runs again play playlist 2, etc.) the order or the playlist doesn’t matter, but does this make sense? I tried to set up the playlists as a veriable (e.g. set thePlaylist to {“1”, “2”, “3”} but iTunes got some kind of error when I did that and it didn’t work. Any suggestions?
Thanks so much,
Rocco
say "Good morning!"
say "Good morning!" using "Alex"
say "Good Morning!" using "Good News"
say "good morning Rocco, it's time to wake up!"
tell application "iTunes"
play playlist "Road Island"
end tell
property myPlayLists : {"Road Island", "Mayne", "Messachusetts"}
set randomNumber to random number from 1 to count myPlayLists
tell application "iTunes"
play playlist item randomNumber of myPlayLists
end tell
Also, while I’m thinking about it, is there a site back up and running for posting completed/fixed applescripts/codes? I feel like this one is one that would be used by osx users.
Actually, some people might not want to play a playlist from all the playlists. But, you have a good idea where you might want to play a random playlist from a set of playlists. Also, the user could add or subtract playlists from this list.
For some reason, when I run this script, replacing the playlist example names with existing playlist names in my iTunes library, it comes back with "iTunes got an error: can’t get item (1, 2, or 3 depending on the random number) of playlist. Any reason why this is happening?
property myPlayLists : {"Road Island", "Mayne", "Messachusetts"}
set randomNumber to random number from 1 to count myPlayLists
tell application "iTunes"
play playlist (item randomNumber of myPlayLists)
end tell
contents of are only useful in repeat with . in loops to dereference a list