Simple applescript for playing music in iTunes
In addition to make skype video calls I thought it would be nice to give my kids some control over playing music on the iMac. So, a new rfid tag was assigned to following simple applescript:
So when the tag is shown to the reader the script either
Using applescript one can do almost anything on iTunes. A good source for further information is http://dougscripts.com/itunes/
tell application "iTunes"
if player state is playing then
stop
else
set the view of the front browser window to playlist "kertun musaa"
set myNumberOfTracks to number of tracks in playlist "kertun musaa"
set randomTrack to (random number (myNumberOfTracks - 1)) + 1
play track randomTrack of user playlist "kertun musaa"
end if
end tellSo when the tag is shown to the reader the script either
- stops the playback if itunes is playing a something, or
- if nothing is playing, starts a play a random song in a named playlist
Using applescript one can do almost anything on iTunes. A good source for further information is http://dougscripts.com/itunes/
Labels: applescript, itunes, osx

