• Hallo liebe Skripter
    So ich brauchte für ein Skript von mir eine Downloadfunktion mit Fortschrittsanzeige
    und dabei ist diese UDF entstanden :

    [autoit]


    ;===============================================================================
    ;
    ; Function Name: _FileDownload()
    ; Description:: Download the Given File with a ProgressBar.
    ;
    ; Parameter(s): $sFileURL = The File-URL to Download.
    ; $sSavepath = The Path to Save the File.
    ;
    ; Requirement(s): None
    ;
    ; Return Value(s): 1 = Sucess
    ; 2 = The File-Url doesn't Exist
    ;
    ; Author(s): DjDominik ([email='AutoIt95@web.de'][/email])
    ;
    ;===============================================================================
    Func _FileDownload($sFileURL = "", $sSavepath = "")
    Local $iFilesize = InetGetSize($sFileURL)
    If $iFilesize = 0 Or @error Then Return 2

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

    ProgressOn("Dateidownload", "Datei(en) Herunterladen.", "0%")

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

    $iFilesize = InetGetSize($sFileURL)
    InetGet($sFileURL, $sSavepath, 1, 1)

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

    $iCurSize = 0
    Do
    FileOpen($sSavepath, 1)
    ProgressSet($iCurSize)
    $iCurFileSize = FileGetSize($sSavepath)
    $iCurSize = $iCurFileSize * 100
    $iCurSize = $iCurSize / $iFilesize
    $iCurSize = Ceiling($iCurSize)
    $iCurFileSize = Round($iCurFileSize / 1024 / 1024, 2)
    FileClose($sSavepath)
    ProgressSet($iCurSize, $iCurFileSize & " MB - " & Round($iFilesize / 1024 / 1024, 2) & " MB (" & $iCurSize & "%)")
    Sleep(200)
    Until $iCurSize >= 99

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

    ProgressOff()
    EndFunc ;==>_FileDownload

    [/autoit]

    Hier ein Beispiel :

    [autoit]


    _FileDownload("http://speedtest.netcologne.de/test_20mb.bin", "Test20MB.bin")

    [/autoit]

    Kommentare Erwünscht!