Local $Timeout = 500 Local $WaitTime = 20000 Local $RestartTime = 5000 Local $Failure Local $FixFailures = 0 Local $Titel = "Internetfixerere 2.0 ultra deluxe pro limited edition" While 1 SearchForErrors() If $Failure == True Then RestartInternet() Else ExitProgram(5) EndIf WEnd Func ExitProgram($time = 5) Local $timeinMs = $time*1000 ProgressOn($Titel, "Inget fel på internet") For $i = $timeinMs To 0 Step -100 ProgressSet($i / $timeinMs * 100, "Programmet stängs om " & Round($i / 1000) & " sekunder") Sleep(100) Next Exit EndFunc ;==>ExitProgram Func SearchForErrors() $Failure = False ProgressOn($Titel, "Vänta ~" & ($WaitTime / 1000) & " sec, piece of shit") For $i = 0 To $WaitTime Step +100 $try = Ping("www.google.se", $Timeout) Sleep(100) If @error Then $Failure = True Return True EndIf ProgressSet($i / $WaitTime * 100, "Letar efter kukar") Next ProgressOff() Return False EndFunc ;==>SearchForErrors Func RestartInternet() ProgressOn($Titel, "Laddar ner bögporr, vänta lite") Run(@ComSpec & " /c " & 'timeout 5', "", @SW_SHOW) For $i = 0 To $RestartTime Step +1000 Sleep(1000) ProgressSet($i / $RestartTime * 100, "Fixing internet") Next Run(@ComSpec & " /c " & 'timeout 5', "", @SW_SHOW) Sleep(5000) ProgressOff() EndFunc ;==>RestartInternet