Sign in to follow this  
Followers 0
supersonic

InetGet - File downloading aborts!?

1 post in this topic

#1 ·  Posted (edited)

Hi everybody,

currently I convert all my scripts from V3.3.0.0 to V3.3.2.0.

Everything works fine so far, but I have no luck with the new

InetGet() function. Often the download aborts. Starting it again

works fine.

OLD version:

Func _WGet($iURL = "", $iDPath = "", $iDFile = "", $iRL = 0, $iBG = 0, $iCDS = 0)
    Local $vTmp1 = 1
    Local $vTmp2 = FileExists($iDPath & "\" & $iDFile)
    Local $vTmp3 = InetGetSize($iURL)
    ; <...>
    If FileExists($iDPath) = 1 Then
        If $iCDS = 1 And $vTmp2 = 1 And $vTmp3 = FileGetSize($iDPath & "\" & $iDFile) Then
            $vTmp1 = 0
        EndIf
        ; <...>
        If (($vTmp1 = 1 And $vTmp3 > 0) Or $vTmp2 = 0) Then
            ; <...>
            InetGet($iURL, $iDPath & "\" & $iDFile, $iRL, $iBG)
            ProgressOn("Downloading " & Chr(133), "", "", -1, -1, 16) ; Asc("…")
            ; <...>
            While @InetGetActive
                ProgressSet((@InetGetBytesRead / $vTmp3) * 100, _xDot(@InetGetBytesRead, 3) & " / " & _xDot($vTmp3, 3) & " Byte(s) [" & Round((@InetGetBytesRead / $vTmp3) * 100, 2) & "%]", $iDFile)
                Sleep(0250)
            WEnd
            ; <...>
            ProgressOff()
        EndIf
    EndIf
EndFunc

NEW version:

Func _WGet($iURL = "", $iDPath = "", $iDFile = "", $iRL = 0, $iBG = 0, $iCDS = 0)
    Local $vTmp1 = 1
    Local $vTmp2 = FileExists($iDPath & "\" & $iDFile)
    Local $vTmp3 = InetGetSize($iURL, $iRL)
    ; <...>
    If FileExists($iDPath) = 1 Then
        If $iCDS = 1 And $vTmp2 = 1 And $vTmp3 = FileGetSize($iDPath & "\" & $iDFile) Then
            $vTmp1 = 0
        EndIf
        ; <...>
        If (($vTmp1 = 1 And $vTmp3 > 0) Or $vTmp2 = 0) Then
            Local $vTmp5 = InetGet($iURL, $iDPath & "\" & $iDFile, $iRL + 16, $iBG)
            ; <...>
            ProgressOn("Downloading " & Chr(133), "", "", -1, -1, 16) ; Asc("…")
            ; <...>
            While InetGetInfo($vTmp5, 2) = False
                ProgressSet((InetGetInfo($vTmp5, 0) / $vTmp3) * 100, _xDot(InetGetInfo($vTmp5, 0), 3) & " / " & _xDot($vTmp3, 3) & " Byte(s) [" & Round((InetGetInfo($vTmp5, 0) / $vTmp3) * 100, 2) & "%]", $iDFile)
                Sleep(0250)
            WEnd
            ; <...>
            InetClose($vTmp5)
            ProgressOff()
        EndIf
    EndIf
EndFunc

Any ideas?

Greets,

-supersonic.

Edited by supersonic

Share this post


Link to post
Share on other sites



Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0