Hi,
I've got a pretty simple script:
here that uses an idle handler to check the status of the network connection.
I'd like to tweak it so that once the network is "good" again the applescript app automatically quits.
So far I have got this:
Code:
on idle
try
set curlScript to "curl www.apple.com"
-- Uncomment the following line if you use a proxy server.
-- set curlScript to "curl --proxy address_of_your_proxy_server:port www.apple.com"
do shell script curlScript
tell application "iTunes"
set oldVolume to sound volume
set sound volume to (sound volume * 0.25)
delay 1
say "Your Network Connection is now available"
delay 1
set sound volume to oldVolume
display dialog "Network Connection now available."
end tell
quit
on error
-- say "Network still down."
end try
return 120
end idle
Which sort of works - the applet will quit - but only once it has become the foremost app.
Does anyone know if this is how it's supposed to happen? Can I get it to quit in the background? I suppose I could get it to send an applescript to itself - telling it to quit - but that would require hard-coding the name of the applet into the script (not ideal.)