Blogger Jeff = new Blogger

Programming and stuff in Western PA

Applescript to repeatedly try to connect to internet stream in ITunes

I listen to the same radio station each and every morning. Problem is, so do a lot of other people. The server I need to connect to allows for a maximum of 100 connections, so what I end up doing is repeatedly trying to connect until I can get one of those connections. Until now….

I created this little applescript to hammer away at that server. I saved it as a playlist, and just run the following :

local e
set e to 0

tell application "iTunes"
			play playlist ("My Radio Station Playlist name")
			delay (2)
		on error errStr number errorNumber
			set e to errorNumber
		end try
		if e is not equal to -5421 then
			exit repeat
			log "Try again"
		end if
	end repeat
end tell

January 7, 2009 Posted by | Technology | , | 1 Comment