Advertisement
stjernan

Untitled

Aug 4th, 2015
316
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. Local $Timeout = 500
  2. Local $WaitTime = 20000
  3. Local $RestartTime = 5000
  4. Local $Failure
  5. Local $FixFailures = 0
  6.  
  7. Local $Titel = "Internetfixerere 2.0 ultra deluxe pro limited edition"
  8.  
  9.  
  10. While 1
  11. SearchForErrors()
  12.  
  13. If $Failure == True Then
  14. RestartInternet()
  15. Else
  16. ExitProgram(5)
  17. EndIf
  18. WEnd
  19.  
  20.  
  21. Func ExitProgram($time = 5)
  22. Local $timeinMs = $time*1000
  23. ProgressOn($Titel, "Inget fel på internet")
  24.  
  25. For $i = $timeinMs To 0 Step -100
  26. ProgressSet($i / $timeinMs * 100, "Programmet stängs om " & Round($i / 1000) & " sekunder")
  27. Sleep(100)
  28. Next
  29. Exit
  30. EndFunc ;==>ExitProgram
  31.  
  32.  
  33. Func SearchForErrors()
  34. $Failure = False
  35. ProgressOn($Titel, "Vänta ~" & ($WaitTime / 1000) & " sec, piece of shit")
  36. For $i = 0 To $WaitTime Step +100
  37.  
  38. $try = Ping("www.google.se", $Timeout)
  39. Sleep(100)
  40.  
  41. If @error Then
  42. $Failure = True
  43. Return True
  44. EndIf
  45.  
  46. ProgressSet($i / $WaitTime * 100, "Letar efter kukar")
  47. Next
  48. ProgressOff()
  49. Return False
  50. EndFunc ;==>SearchForErrors
  51.  
  52. Func RestartInternet()
  53. ProgressOn($Titel, "Laddar ner bögporr, vänta lite")
  54.  
  55.  
  56. Run(@ComSpec & " /c " & 'timeout 5', "", @SW_SHOW)
  57. For $i = 0 To $RestartTime Step +1000
  58. Sleep(1000)
  59. ProgressSet($i / $RestartTime * 100, "Fixing internet")
  60. Next
  61. Run(@ComSpec & " /c " & 'timeout 5', "", @SW_SHOW)
  62. Sleep(5000)
  63.  
  64. ProgressOff()
  65. EndFunc ;==>RestartInternet
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement