Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Some, uh, "tweaks"!' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Some, uh, "tweaks"!
Authored by: sinjin on Mar 02, '04 04:26:10PM
I love scripts like these, so much fun to play around with. I've modified the code somewhat. It is now more encapsulated (so that iTunes is turned down if the network is up or down) and determines if iTunes is running at all before turning it's volume down; otherwise the script would launch iTunes for no reason (I don't always have iTunes running). Oh, and now the applescript insults you. Vary to tastes! ;-)

on idle
	set availText to "Your Network Connection is now available, geek."
	set unavailText to "The network is still down, you loser."
		set curlScript to "curl"
		--      Uncomment the following line if you use a proxy server.
		--              set curlScript to "curl --proxy address_of_your_proxy_server:port"                
		do shell script curlScript
		my networkStatus(availText)
	on error
		my networkStatus(unavailText)
	end try
	return 120
end idle

on networkStatus(speakText)
	tell application "System Events"
		if (exists process "iTunes") then
			tell application "iTunes"
				set oldVolume to sound volume
				set sound volume to (sound volume * 0.25)
				delay 1
				say speakText
				delay 1
				set sound volume to oldVolume
				--display dialog "Network Connection now available."
			end tell
			say speakText
		end if
	end tell
end networkStatus

[ Reply to This | # ]