Applescript to test DSL connection - problem
My home internet connection is so poor, I decided to write the following Applescript to monitor the connection and record data so that I can provide this information to the service provider (along with a request for a refund!). Basically the script checks the connection every 2 minutes and records whether the connection is up or down, along with a date and time stamp:
on idle
try
set the_file to "Macintosh HD:Users:farman:Desktop:DSL_log.txt"
set the_file to quoted form of POSIX path of the_file
do shell script "curl www.apple.com"
set success to " DSL OK"
set d to (current date) as string
do shell script "echo " & d & success & " >> " & the_file
say DSL is OK"
on error
set the_file to "Macintosh HD:Users:farman:Desktop:DSL_log.txt"
set the_file to quoted form of POSIX path of the_file
set failure to " DSL down"
set d to (current date) as string
do shell script "echo " & d & failure & " >> " & the_file
say "DSL is down"
end try
return 120
end idle
The only problem is that sometimes when I am unable to connect to the web (i.e. web pages don't show up), my Speedstream router pops up a window that tells me that the DSL down, but the script tells me the DSL is still OK. Any idea what gives? I'm guessing the connection is sufficient to return success on the curl command but is too noisy to allow a complete page to load. Are there perhaps other ways to test the connection?
MacBook Pro, Mac OS X (10.5.6)