Shake that booty for the applescript dudey
So, the Mrs and I were sitting around at home last weekend. She starts playing this game with iTunes, where she was dancing to the first minute or so of each song on one of her playlists. From rock to dance to swing and blues did she go. It was so much fun I joined in too!
In order to make this game available and easy for the rest of the world, I made a little Applescript which automates the process with iTunes.
All you need to do is save the script as an application (or download a compiled version here*), run it and shake that booty!
-
tell application "iTunes"
-
set playlistsList to ""
-
repeat with pl in playlists
-
set playlistsList to playlistsList & name of pl & ", "
-
end repeat
-
repeat while true
-
set response to display dialog "Which playlist should I use (blank for everything) ?
-
Available playlists are:
-
" & playlistsList default answer ""
-
if text returned of response is not "" then
-
try
-
set thePlaylist to playlist named (text returned of response)
-
play thePlaylist
-
set the view of the front browser window to thePlaylist
-
exit repeat
-
on error
-
display dialog "Whoops! You entered a playlist name that didn't exist" buttons {"Ok"}
-
end try
-
else
-
play playlist "Library"
-
set the view of the front browser window to playlist "Library"
-
exit repeat
-
end if
-
end repeat
-
end tell
-
-
property keepplaying : true
-
repeat while keepplaying
-
do shell script "sleep 15"
-
tell application "iTunes"
-
if player state is stopped then
-
set keepplaying to false
-
exit repeat
-
else if player position> 44 then
-
next track
-
end if
-
end tell
-
end repeat
-
quit
N.B.I still haven't found a way to keep a dialog open waiting for input while doing other stuff. Anyone got any ideas?
*Does not contain a virus to the best of my knowledge, no warranty, I'm not liable if it breaks stuff, yada yada, insert usual software disclaims here.
Technorati Tags:
AppleScript, Mac, Games, Fun, dancing, iTunes