;Load http.au3 #include "HTTP.au3" ;Set Parameters $RemoteIP = "192.168.3.2" $LocalIP = "192.168.3.1" $TelnetPort = 23 $SleepTime = 15 * 60 * 1000 ;15 minutes $ResetTime = 5 ;reset router at 5am $ResetBool = False Opt("TrayIconHide", 1) Opt("TrayIconDebug", 1) ;Run Loop While 1 ;Reset Router at the time set no matter what If @HOUR == $ResetTime And $ResetBool == False Then ResetRouter($LocalIP) $ResetBool = True Else $ResetBool = False EndIf Sleep(60 * 1000) ; wait one minute ;Check Wireless Connection $RemoteConnectionOK = CheckRemoteRouter($RemoteIP, $TelnetPort) If Not $RemoteConnectionOK Then ResetRouter($LocalIP) EndIf ;Put Program To Sleep Sleep($SleepTime) WEnd Func ResetRouter($IP) $host = "http://" & $IP & "/" $page = "/restart.cgi" $data = "restart=Restart" $socket = _HTTPConnect($IP) _HTTPPost($host, $page, $socket, $data, "admin", "admin") EndFunc ;==>ResetRouter Func CheckRemoteRouter($IP, $Port) TCPStartup() $socket = TCPConnect($IP, $Port) TCPShutdown() If $socket = -1 Then Return False ;connection bad Else Return True ;connection good EndIf EndFunc ;==>CheckRemoteRouter
Get #include "HTTP.au3" from here, with my mod at the last post.
http://www.autoitscript.com/forum/index.php?showtopic=29631
http://www.autoitscript.com/forum/index.ph...mp;#entry601371





