Saturday, December 08, 2007

Small Applescript to make iTunes play

I recently put my Mac mini into a server room and am running it headless now.
As this one also has the iTunes library and the connection to the stereo, I was using VNC to connect to it and to start and stop iTunes. Of course that is cumbersome.
So I googled a little on "applescript" and "iTunes" and found this wonderful site.

Using the information on it I was able to come up with this script, that I saved as playTunes.scpt

tell application "iTunes"
if player state is paused then
play user playlist "a_Ungespielt"
return "Playing"
else
pause
return "Stopped"
end if
end tell


It will play the contents of a playlist called "a_Ungespielt" if iTunes is paused and stop playing otherwise.

I can now just log into the mini and start/stop playing with "osascript playTunes.scpt".

No comments: