INetGet

  • Hallo,
    makiere den Begriff InetGet und gib in Scite dann F1 ein.
    Dann findest du unter direkt ein Beispiel.

  • Hallo manilus,

    da es um die Downloadgeschwindigkeit geht, habe ich das Beispiel angepasst:

    Spoiler anzeigen
    [autoit]

    Global $nKPerSec, $tDiff, $iToDo, $iRTime, $nKBPerSec, $sMSG
    Global $iSize = 86507 ;InetGetSize("http://www.autoit.de") ;siehe Hilfe zu InetgetSize
    InetGet("http://www.autoit.de", @ScriptDir & "\Testdownload.htm", 1, 1)
    Global $tStart = TimerInit()

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

    While @InetGetActive
    If @InetGetBytesRead > 0 Then
    _CalcPerformance()
    TrayTip("downloading", $sMSG, 10, 16)
    EndIf
    Sleep(250)
    WEnd
    If @InetGetBytesRead > -1 Then
    $iSize = @InetGetBytesRead ;damit die Größe für die Endabrechnung stimmt
    _CalcPerformance()
    TrayTip("downloading", $sMSG, 10, 16)
    MsgBox(0, "Download erfolgreich", $sMSG)
    Else
    MsgBox(48, "Fehler", "Download nicht erfolgreich")
    EndIf

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

    Func _CalcPerformance()
    $tDiff = TimerDiff($tStart)
    $iToDo = Round(($iSize - @InetGetBytesRead) / 1024, 2)
    $nKBPerSec = Round(@InetGetBytesRead / $tDiff * 1000 / 1024, 2)
    $iRTime = Round($iToDo / $nKBPerSec, 0)
    $sMSG = "Bytes = " & @InetGetBytesRead & @CRLF & "KB/s = " & $nKBPerSec & @CRLF
    If @InetGetActive Then
    $sMSG = $sMSG & "verbleibende Zeit = " & $iRTime
    Else
    $sMSG = $sMSG & "benötigte Zeit = " & Round($tDiff / 1000, 2)
    EndIf
    EndFunc ;==>_CalcPerformance

    [/autoit]

    Edit: kalkulierte Restdauer für Download eingefügt

    mfg (Auto)Bert

    2 Mal editiert, zuletzt von AutoBert (9. Oktober 2009 um 01:22)