ICS - Internet Connection State

  • Guten Mittag, liebe AutoIt'ler,

    mir war langweilig und da habe ich mir ein kleines Skript geschrieben, welches in gewissem Abstand checkt, ob man eine Verbindung zum Internet hat oder eben nicht.
    Außerdem wird jedes mal für 5 Sekunden eine kleine Meldung rechts unten angezeigt, wenn dieser Status wechselt.
    Es gibt keine GUI, nur ein Tray-Icon (+Tray-Menü), über das man alles steuern kann.
    Wenn man das Programm mit einer Zahl als Parameter startet, wird diese Zeit als Delay voreingestellt.


    Ich habe das Script und das Icon in einer .zip angehängt.

    Funktionen

    - Überprüfung pausieren
    - Alle x Sekunden checken (Delay)
    - Verknüpfung erstellen lassen (Voreingestellter Zeit-Parameter)

    Source
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=Icon\ICS.ico
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=Rafael K. (Joriktos)
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    #include <Constants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    Opt("TrayMenuMode", 3)
    TraySetClick(8)

    [/autoit] [autoit][/autoit] [autoit]

    Global $bConnected
    Global $bPause = False
    Global $iDelay = 5000
    Global $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")

    [/autoit] [autoit][/autoit] [autoit]

    If $CmdLine[0] <> 0 Then
    If StringIsDigit($CmdLine[1]) = 1 Then
    $iDelay = $CmdLine[1] * 1000
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    Global $idTrayPause = TrayCreateItem("Pause Checking")
    TrayItemSetState($idTrayPause, $TRAY_DEFAULT)
    Global $idTrayCheck = TrayCreateItem("Start Checking")
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE)
    Global $idTrayDelay = TrayCreateItem("Delay")
    TrayCreateItem("")
    Global $idTrayShortcut = TrayCreateItem("Shortcut with Delay")
    TrayCreateItem("")
    Global $idTrayExit = TrayCreateItem("Exit")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    Else
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _ToolTipClose()
    _Check()

    [/autoit] [autoit][/autoit] [autoit]

    Func _TrayMsg()
    $nTrayMsg = TrayGetMsg()
    Switch $nTrayMsg
    Case $idTrayDelay
    _Delay()
    Case $idTrayPause
    _Pause()
    Case $idTrayCheck
    _StartCheck()
    Case $idTrayShortcut
    _Shortcut()
    Case $idTrayExit
    Exit
    EndSwitch
    Return
    EndFunc ;==>_TrayMsg

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Check()
    While 1
    $iTimer = TimerInit()
    While TimerDiff($iTimer) < $iDelay
    _TrayMsg()
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")

    [/autoit] [autoit][/autoit] [autoit]

    If $bConnected = True And $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet")
    ToolTip("You're not connected to the Internet anymore.", @DesktopWidth - 283, @DesktopHeight - 70, "Connection lost", 2)
    _ToolTipClose()
    ElseIf $bConnected = False And $iPing <> 0 Then
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're now connected to the Internet.", @DesktopWidth - 238, @DesktopHeight - 70, "Connection found", 1)
    _ToolTipClose()
    EndIf
    WEnd
    EndFunc ;==>_Check

    [/autoit] [autoit][/autoit] [autoit]

    Func _Pause()
    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    TrayItemSetState($idTrayPause, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayCheck, $TRAY_ENABLE + $TRAY_DEFAULT)
    _ToolTipClose()
    While 1
    _TrayMsg()
    WEnd
    EndFunc ;==>_Pause

    [/autoit] [autoit][/autoit] [autoit]

    Func _StartCheck()
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayPause, $TRAY_ENABLE + $TRAY_DEFAULT)
    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")
    If $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    Else
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _ToolTipClose()
    _Check()
    EndFunc ;==>_StartCheck

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToolTipClose()
    $iTipTimer = TimerInit()
    While TimerDiff($iTipTimer) < 5000
    _TrayMsg()
    WEnd
    ToolTip("")
    EndFunc ;==>_ToolTipClose

    [/autoit] [autoit][/autoit] [autoit]

    Func _Shortcut()
    $iShortcutDelay = $iDelay / 1000
    $sAnswer = InputBox("Delay after shortcut-start", "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iShortcutDelay = $sAnswer
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay after shortcut-start", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 150)
    EndIf
    WEnd
    FileCreateShortcut(@ScriptFullPath, @ScriptDir & "\Internet Connection State.lnk", "", $iShortcutDelay, "", @SystemDir & "\shell32.dll", "", -14)
    Return
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Delay()
    $sAnswer = InputBox("Delay", "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iDelay = $sAnswer * 1000
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 150)
    EndIf
    WEnd
    Return
    EndFunc ;==>_Delay

    [/autoit]


    Gruß
    Joriktos

  • Ist schonmal ein sehr schönes Skript. Ich würde es gerne benutzen, wenn du es hinkriegst/programmierst, jede Minute auch die Downloadgeschwindigkeit zu errechnen und das ganze in ein Log schreibst. :thumbup:
    Sowas wollte ich nämlich schon länger mal machen, hatte aber nie Lust damit anzufangen, ich hab genug andere interessante Projekte ^^

  • Geht klar, die Log-Funktion wollte ich eh noch einbauen und das mit der Downloadgeschwindigkeit sollte dann auch kein Problem sein :D
    Soll die dann nur in den Log geschrieben werden oder jede Minute unten angezeigt werden?

    Edit: Und in welcher Einheit möchtest du die Geschwindigkeit haben? :)

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)

    Einmal editiert, zuletzt von Joriktos (17. März 2013 um 12:52)

  • Was heißt denn da sogar?! :huh: Achwas, nimms nich ernst :thumbup:

    Okay, dann setz ich mich da mal ran ;)


    (Edit: Außerdem ist er nicht mal sooo sauber, ich hab nämlich keinerlei Kommentare ;) Faulheit lässt grüßen... :whistling: )

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)

  • Okay, dann ist's ja sogar nen Kompliment ;) Also ich code aber noch gar nicht so lange mit AutoIt ;)

    P.S. Ich mach das ganze morgen fertig ;)

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)

  • So, jetzt wird auch die Downloadgeschwindigkeit berechnet und ein Log-File im ScriptDir gespeichert.

    Kommentare hab ich noch nicht vollständig, werde ich aber noch vervollständigen und dann hier reineditieren ;)

    Source
    [autoit]


    #Region ;**** Directives created by AutoIt3Wrapper_GUI ****
    #AutoIt3Wrapper_Icon=Icon\ICS.ico
    #AutoIt3Wrapper_Res_Fileversion=1.0.0.0
    #AutoIt3Wrapper_Res_LegalCopyright=Rafael K. (Joriktos)
    #EndRegion ;**** Directives created by AutoIt3Wrapper_GUI ****

    [/autoit] [autoit][/autoit] [autoit]

    #include <Constants.au3>

    [/autoit] [autoit][/autoit] [autoit]

    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    Opt("TrayMenuMode", 3) ; Keine Häkchen im Tray-Menü, kein Standard-Menü.
    TraySetClick(8) ; Tray-Menü nur bei Rechtsklick öffnen.

    [/autoit] [autoit][/autoit] [autoit]

    Global $sURL = "http://www.autoitscript.com/cgi-bin/getfile.pl?autoit3/autoit-v3.3.8.1-setup.exe" ; Datei, die heruntergeladen wird um die Downloadgeschwindigkeit zu errechnen.

    [/autoit] [autoit][/autoit] [autoit]

    Global $hDownload ; Handle zum Download.
    Global $iSize ; Größe der Datei, die heruntergeladen werden soll.
    Global $iSizeCompleted ; Größe der bereits heruntergeladenen Daten (in Bytes).
    Global $iSizeCompletedBefore ; Größe der bereits heruntergeladenen Daten beim letzten Check.
    Global $aSpeedAverageValues[1001] ; Hier werden die letzten 1000 Gechwindigkeits-Messwerte gespeichert. Index 0 enthält die Anzahl der bereits gemessenen Werte (Während am Anfang noch keine 1000 Messwerte vorhanden sind).
    Global $iSpeedAverage = 0 ; Die aktuelle Durchschnittsgeschwindigkeit
    Global $iSpeedAverageValueCount = 0 ; Der Index der in $aSpeedAverageValues beschrieben, beziehungsweise überschrieben werden soll.
    Global $nSpeedTimer ; Die Zeit, die zwischen 2 Messungen vergangen ist, um die Geschwindigkeit daraus zu errechnen.

    [/autoit] [autoit][/autoit] [autoit]

    Global $iMinute = 60000 ; Zeit in Millisekunden, nach der die aktuelle Downloadgeschwindigkeit in den Log geschrieben wird.
    Global $nMinuteTimer = TimerInit() ; Zeitmessung um Downloadgeschwindigkeit in den Log zu schreiben.

    [/autoit] [autoit][/autoit] [autoit]

    Global $bConnected ; True, wenn mit dem Internet verbunden. False, wenn nicht mit dem Internet verbunden.
    Global $bPause = False ; True, wenn gerade nichts gecheckt werden soll. False, wenn gecheckt werden soll.
    Global $iDelay = 5000 ; Zeit in Millisekunden nach der die Internetverbindung überprüft werden soll.
    Global $iPing = Ping("www.google.com") ; Wenn Ping nicht 0 ist, ist eine Verbindung zum Internet (bzw. zu google.com) vorhanden.
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de") ; Falls google.com nicht erreichbar ($iPing = 0) ist, werden noch 2 andere Websites gecheckt.

    [/autoit] [autoit][/autoit] [autoit]

    If $CmdLine[0] <> 0 Then ; Falls ICS mit einem (oder mehreren) Parametern gestartet wurde:
    If StringIsDigit($CmdLine[1]) = 1 Then ; Falls der Parameter eine Ganzzahl enthält:
    $iDelay = $CmdLine[1] * 1000 ; Das angegebene Delay * 1000 nehmen (um Millisekunden zu erhalten) und in $iDelay speichern.
    EndIf
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $hLogFile = FileOpen(@ScriptDir & "\ICS.log", 9) ; Log-Datei als Handle öffnen (Wird erstellt, falls noch nicht vorhanden).
    FileWriteLine($hLogFile, "__________________________________ " & @MDAY & "." & @MON & "." & @YEAR & " __________________________________" & @CRLF & @CRLF) ; "Sessionsmarkierung" mit Datum hinzufügen.
    _Log("Started ICS.") ; In Log schreiben.
    _Log("Checkdelay: " & $iDelay / 1000 & " seconds.")

    [/autoit] [autoit][/autoit] [autoit]

    Global $idTrayPause = TrayCreateItem("Pause Checking")
    TrayItemSetState($idTrayPause, $TRAY_DEFAULT)
    Global $idTrayCheck = TrayCreateItem("Start Checking")
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE)
    Global $idTrayDelay = TrayCreateItem("Delay")
    TrayCreateItem("")
    Global $idTrayShortcut = TrayCreateItem("Shortcut with Delay")
    TrayCreateItem("")
    Global $idTrayExit = TrayCreateItem("Exit")

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    If $iPing = 0 Then ; Falls nicht zum Internet verbunden:
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    _Log("Disconnected from the Internet.")
    Else ; Falls zum Internet verbunden:
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    _Log("Connected to the Internet.")

    [/autoit] [autoit][/autoit] [autoit]

    $iSize = InetGetSize($sURL)
    _DownloadStart()
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    _ToolTipClose()
    _Check()

    [/autoit] [autoit][/autoit] [autoit]

    Func _TrayMsg()
    $nTrayMsg = TrayGetMsg()
    Switch $nTrayMsg
    Case $idTrayDelay
    _Delay()
    Case $idTrayPause
    _Pause()
    Case $idTrayCheck
    _StartCheck()
    Case $idTrayShortcut
    _Shortcut()
    Case $idTrayExit
    InetClose($hDownload)
    _Log("Closed ICS." & @CRLF & @CRLF & @CRLF)
    FileClose($hLogFile)
    Exit
    EndSwitch
    Return
    EndFunc ;==>_TrayMsg

    [/autoit] [autoit][/autoit] [autoit][/autoit] [autoit]

    Func _Check()
    While 1
    $iTimer = TimerInit() ; Timer initialisieren
    While TimerDiff($iTimer) < $iDelay ; Solange ausführen, bis der Timer das Delay erreicht hat:
    _TrayMsg()

    [/autoit] [autoit][/autoit] [autoit]

    If $bConnected = True Then ; Falls zum Internet verbunden:
    If InetGetInfo() = 0 Or InetGetInfo($hDownload, 2) = True Then ; Falls die Datei noch nicht geladen wird oder wenn sie fertig geladen hat:
    _DownloadStart()
    Else ; Falls die Datei am laden ist:
    $iSizeCompleted = InetGetInfo($hDownload, 0) ; Menge der bereits geladenen Daten in Bytes.
    If $iSizeCompletedBefore < $iSizeCompleted Then ; Falls immernoch der gleiche Download läuft (was Voraussetzung zum Geschwindigkeit errechnen ist), ist $iSizeCompleted größer als $iSizeCompletedBefore:
    $iSpeedAverageValueCount += 1
    If $iSpeedAverageValueCount > 1000 Then ; Falls $iSpeedAverageValueCount 1000 erreicht hat, sollen die alten Werte wieder überschrieben werden um einen aktuellen Durchschnitt zu erhalten:
    $iSpeedAverageValueCount = 1
    EndIf
    $nBPS = $iSizeCompleted / (TimerDiff($nSpeedTimer) / 1000)
    If $aSpeedAverageValues[0] <= 1000 Then
    $aSpeedAverageValues[0] = $iSpeedAverageValueCount
    $aSpeedAverageValues[$iSpeedAverageValueCount] = $nBPS
    ElseIf $aSpeedAverageValues[0] = 1000 Then
    $aSpeedAverageValues[$iSpeedAverageValueCount] = $nBPS
    EndIf
    For $i = 1 To $aSpeedAverageValues[0]
    $iSpeedAverage += $aSpeedAverageValues[$i]
    Next
    $iSpeedAverage = $iSpeedAverage / $aSpeedAverageValues[0]
    EndIf
    $iSizeCompletedBefore = $iSizeCompleted
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    If TimerDiff($nMinuteTimer) > $iMinute And (Int($iSpeedAverage) / 1024) <> 0 Then
    _Log("Download speed: " & Int($iSpeedAverage / 1024) & "kb/s")
    $nMinuteTimer = TimerInit()
    EndIf
    EndIf
    WEnd

    [/autoit] [autoit][/autoit] [autoit]

    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")

    [/autoit] [autoit][/autoit] [autoit]

    If $bConnected = True And $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet")
    ToolTip("You're not connected to the Internet anymore.", @DesktopWidth - 283, @DesktopHeight - 70, "Connection lost", 2)
    _Log("Connection lost")
    _ToolTipClose()
    ElseIf $bConnected = False And $iPing <> 0 Then
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're now connected to the Internet.", @DesktopWidth - 238, @DesktopHeight - 70, "Connection found", 1)
    _Log("Connection found")
    $iSize = InetGetSize($sURL)
    _ToolTipClose()
    EndIf
    WEnd
    EndFunc ;==>_Check

    [/autoit] [autoit][/autoit] [autoit]

    Func _Pause()
    _Log("Stopped checking.")
    TraySetIcon(@SystemDir & "\shell32.dll", 16739)
    TrayItemSetState($idTrayPause, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayCheck, $TRAY_ENABLE + $TRAY_DEFAULT)
    _ToolTipClose()
    While 1
    _TrayMsg()
    WEnd
    EndFunc ;==>_Pause

    [/autoit] [autoit][/autoit] [autoit]

    Func _StartCheck()
    _Log("Started checking.")
    TrayItemSetState($idTrayCheck, $TRAY_DISABLE + $TRAY_DEFAULT)
    TrayItemSetState($idTrayPause, $TRAY_ENABLE + $TRAY_DEFAULT)
    $iPing = Ping("www.google.com")
    If $iPing = 0 Then $iPing += Ping("www.autoit.de") + Ping("www.web.de")
    If $iPing = 0 Then
    $bConnected = False
    TraySetIcon(@SystemDir & "\shell32.dll", 161)
    TraySetToolTip("You're NOT connected to the Internet.")
    ToolTip("You're not connected to the Internet.", @DesktopWidth - 233, @DesktopHeight - 70, "No Connection", 2)
    _Log("Disconnected from the Internet.")
    Else
    $bConnected = True
    TraySetIcon(@SystemDir & "\shell32.dll", 14)
    TraySetToolTip("You're connected to the Internet.")
    ToolTip("You're connected to the Internet.", @DesktopWidth - 212, @DesktopHeight - 70, "Connected", 1)
    Global $iSize = InetGetSize($sURL)
    _Log("Connected to the Internet.")
    EndIf

    [/autoit] [autoit][/autoit] [autoit]

    $nMinuteTimer = TimerInit()
    _ToolTipClose()
    _Check()
    EndFunc ;==>_StartCheck

    [/autoit] [autoit][/autoit] [autoit]

    Func _ToolTipClose()
    $iTipTimer = TimerInit()
    While TimerDiff($iTipTimer) < 5000
    _TrayMsg()
    WEnd
    ToolTip("")
    EndFunc ;==>_ToolTipClose

    [/autoit] [autoit][/autoit] [autoit]

    Func _Shortcut()
    $iShortcutDelay = $iDelay / 1000
    $sAnswer = InputBox("Delay after shortcut-start", "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iShortcutDelay = $sAnswer
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay after shortcut-start", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iShortcutDelay, " M3", 300, 150)
    EndIf
    WEnd
    FileCreateShortcut(@ScriptFullPath, @ScriptDir & "\Internet Connection State.lnk", "", $iShortcutDelay, "", @SystemDir & "\shell32.dll", "", -14)
    _Log("Created shortcut with a delay of " & $iShortcutDelay & " seconds. Saved to '" & @ScriptDir & "\Internet Connection State.lnk'.")
    Return
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _Delay()
    $sAnswer = InputBox("Delay", "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 125)
    $bAnswerCheck = False
    While $bAnswerCheck = False
    If @error = 1 Then
    Return
    ElseIf StringIsDigit($sAnswer) = 1 And @error = 0 Then
    $iDelay = $sAnswer * 1000
    $bAnswerCheck = True
    Else
    $sAnswer = InputBox("Delay", "Your Input was wrong. Try it again:" & @CRLF & @CRLF & "Insert the Delay (in Seconds) to check the connection:", $iDelay / 1000, " M3", 300, 150)
    EndIf
    WEnd
    _Log("Checkdelay set to " & $iDelay / 1000 & " seconds.")
    Return
    EndFunc ;==>_Delay

    [/autoit] [autoit][/autoit] [autoit]

    Func _Log($sLine)
    FileWriteLine($hLogFile, @HOUR & ":" & @MIN & ":" & @SEC & " - " & $sLine)
    EndFunc

    [/autoit] [autoit][/autoit] [autoit]

    Func _DownloadStart()
    $hDownload = InetGet($sURL, @TempDir & "\Downloadspeed.exe", 1, 1)
    $nSpeedTimer = TimerInit()
    Return
    EndFunc

    [/autoit]


    TheShadowAE: Hast du's dir so vorgestellt? :)

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)

  • Kannst du mir sagen, wie das funktionieren würde? :)

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)

  • Aber es soll ja dauerhaft gemessen werden um einen schönen Wert zu bekommen ;) (Ich lasse ja sogar den Durchschnitt der 1000 letzten ermessenen Werte nehmen ;) )

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)

  • Stimmt, deine Gedanken lesen kann ich natürlich nicht ;)


    Mal eine Frage an alle anderen: Kann's wer gebrauchen? Was haltet ihr von dem Script? Danke für Rückmeldungen :)

    Da es hier doch einige falsch machen:

    Zitat von einem User dieses Forums

    Die Standard-Standart eines Flamingos ist einbeinig. ;)