Rapidshare downloader mit Fortschrittsbalken

  • Hey Leute,
    ich habe in den Rapidshare downloader von McPoldy einen Fortschrittsbalken eingebaut. Bei der ersten Datei die gedownloaded wird, funkt auch alles super. Nur bei jeder darauffolgenden Datei, ist der Fortschrittsbalken schon voll und es steht dort, dass auch schon alles gedownloaded wäre.
    Ich habe rausgefunden, dass das von der wert abhängt, der von @Inetgetbytesread zurückgegeben wird. Kann man irgendwie nach jeden Vorgang diesen Wert sozusagen "resetten"?
    Hier das Script:

    Spoiler anzeigen
    [autoit]

    #include <IE.au3>
    #include <Array.au3>
    #include<String.au3>
    #include <Guiconstants.au3>

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

    Global $links[1]
    Global $Vorher = 0
    Global $Pause = 250

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

    ; <-- siehe Infos 4.
    ; Lade Datein
    $oFile = FileOpen(@ScriptDir & '\dateilinks.txt', 0)
    While 1
    $line = FileReadLine($oFile)
    If @error = -1 Then ExitLoop
    $str = StringStripWS($line, 3)
    If $str <> '' Then _ArrayAdd($links, $str)
    WEnd
    FileClose($oFile)
    $links[0] = UBound($links) - 1
    If $links[0] = 0 Then Exit
    ; -->

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

    Call("_download")
    Func _download()
    For $i = 1 To $links[0]
    $oIE = _IECreate("about:blank")
    Sleep (5000)
    ; <-- siehe Infos 1.
    _IENavigate($oIE, $links[$i])
    $oForm = _IEFormGetObjByName($oIE, "ff")
    _IEFormSubmit($oForm, 0)
    ; -->
    ; <-- siehe Infos 2.
    _IELoadWait($oIE)
    $durchlauf = 0
    Do
    $durchlauf = $durchlauf + 1
    $oForm = _IEFormGetObjByName($oIE, "dlf")
    If $oForm = 0 Then Sleep(5000)
    If $durchlauf = 33 Then
    ControlSend ("RapidShare","","[CLASS:Internet Explorer_Server; INSTANCE:1]","{F5}")
    Sleep (4000)
    ControlSend ("Windows Internet Explorer","","[CLASS:Static; INSTANCE:2]","{Enter}")
    $durchlauf = 0
    EndIf
    Until $oForm <> 0
    ; <-- siehe Infos 3.
    $str = StringSplit($oForm.action, '/')
    ; -->
    $size = InetGetSize($oForm.action) ;Dateigröße ermitteln
    InetGet($oForm.action, @ScriptDir & '\download\' & $str & $str[UBound($str) - 1], 1, 1)

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

    Global $iDownSize = 0
    Global $prosize = 0
    Global $loadedsize = 0
    Global $trueloadedsize = 0
    Global $finalsize = 0
    Global $truefinalsize = 0

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

    $Form1 = GUICreate($str[UBound($str) - 1], 300, 80, 192, 124)
    $Progress1 = GUICtrlCreateProgress(5, 5, 290, 16)
    GUICtrlSetData($Progress1, 0)
    $Label1 = GUICtrlCreateLabel("Bitte warten...", 5, 25, 300, 20)
    GUICtrlSetData($Label1, "Bitte warten...")
    $button = GUICtrlCreateButton ("Download fertig machen, dann Ende",50,45,-1,-1)
    GUISetState(@SW_SHOW)
    _IEQuit($oIE)
    Sleep(10000)
    $ende = 0
    While @InetGetActive
    $msg = GUIGetMsg ()
    If $msg = $button Then
    $ende = 1
    GUICtrlSetState ($button,$GUI_DISABLE)
    EndIf
    Sleep(300)
    $iDownSize = @InetGetBytesRead
    $prosize = Round(100 / $size * $iDownSize, 1)
    $loadedsize = $iDownSize / 1000000
    $trueloadedsize = Round($loadedsize, 3)
    $finalsize = $size / 1000000
    $truefinalsize = Round($finalsize, 3)
    GUICtrlSetData($Progress1, $prosize)
    GUICtrlSetData($Label1, $trueloadedsize & " von " & $truefinalsize & " Megabytes heruntergeladen. (" & $prosize & " %)")
    WEnd
    GUIDelete()
    If $ende = 1 Then Exit
    ; -->
    Next
    EndFunc ;==>_download

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

    ; <-- siehe Infos 5.

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

    ; -->

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

    ; <-- siehe Infos

    [/autoit]

    Danke

    LG
    Manlius