Version 0 of Windows Internet connection monitor and repair tool

Updated 2007-03-15 21:17:05

Why - I have my internet connection through a wireless provider and have run into issues with it getting stuck and not routeing traffic. I found clicking on the connection in my task bar and choosing repair tended to fix the issue. This problem only seem to happen when I am using my bittorrent client which tells me its probably just a limitation on the wireless adapter that I am hitting.

What - I started looking for a windows solution to correct this issue or self-heal it when it became unresponsive. I really could not find anything and kept thinking if this were a unix box I could write a short script to take care of it. Then the giant light bulb went off over my head and I realized I could write a TCL script to do just that with ActiveTCL and a some windows knowledge.

How - First I downloaded and installed ActiveTCL from activestates website. I also needed a program called devcon that can be found on Microsofts website as a free download.

Source

 wm withdraw .
 proc writelog {data} {
     set timestamp [clock format [clock seconds] -format {%D %X}]
     set fileId [open c:\\batch\\winnetfix.log a+]
     puts $fileId "$timestamp - $data"
     close $fileId
 }
 catch {exec c:\\windows\\system32\\ping.exe -n 1 192.168.1.1} result
     switch -glob $result {
         *from* {set connection 1}
         *timed* (set connection 0; writelog "Timed Out"}
         default {set connection 0; writelog "Default Used"}
     }
 if {$connection == 0} {
     catch {exec c:\\batch\\devcon.exe disable @USB\\VID_07B8&PID_6001\\6&3534C65&0&5 } disable
     catch {exec c:\\batch\\devcon.exe enable @USB\\VID_07B8&PID_6001\\6&3534C65&0&5 } enable
     writelog "Fixed Connection!"
     exit
 }
 exit