Jump to content

Download Progress Bar


Tiger
 Share

Recommended Posts

This is the code:

#cs ----------------------------------------------------------------------------

 AutoIt Version: 3.2.4.9
 Author:         Tiger

 Script Function:
    Template AutoIt script.

#ce ----------------------------------------------------------------------------

Func InetGetwithProgress()
    
    $window = GUICreate("", 400, 40, -1, -1, $WS_POPUP + $WS_CAPTION, $WS_EX_TOOLWINDOW)
    $progress = GUICtrlCreateProgress(10, 10, 380, 20)
    GUISetState(@SW_SHOW, $window)
    
    InetGet($url, $path, 1, 1)
    
    While @InetGetActive
        Sleep(100)
        GUICtrlSetData($progress, Round(((@InetGetBytesRead / $size) * 100), 1))
    WEnd
        
    GUIDelete($window)
    
    If FileExists($path) Then
        SetError(-1)
    Else
        SetError(1)
    EndIf
    
EndFunc   ;==>InetGetwithProgress
Edited by Tiger
My UDFs:- _RegEnumKey
Link to comment
Share on other sites

Well you need something

$size = InetGetSize ( "URL" )

But to make the total you could do something like..

$size = InetGetSize ( "URL1" )

$size = $size + InetGetSize ( "URL2" )

$size = $size + InetGetSize ( "URL3" )

$size = $size + InetGetSize ( "URL4" )

You would then have the global size...

And then you could have a variabel to count upwards as the @InetGetBytesRead rises.. Gonna look at it in the morning

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

Arg couldn't sleep :)

#include <GUIConstants.au3>

Func InetGetwithProgressMulti($arArray)
    
    $window = GUICreate("", 400, 70, -1, -1, $WS_POPUP + $WS_CAPTION, $WS_EX_TOOLWINDOW)
    $singleprogress = GUICtrlCreateProgress(10, 10, 380, 20)
    $multiprogress = GUICtrlCreateProgress(10, 40, 380, 20)
    GUISetState(@SW_SHOW, $window)
    
    $totalsize = 0
    $totalread = 0
    For $i = 0 To UBound($arArray) - 1
        $totalsize += InetGetSize($arArray[$i][0])
    Next
    
    For $i = 0 To UBound($arArray) - 1
        $size = InetGetSize($arArray[$i][0])
        GUICtrlSetData($singleprogress, 0, 1)
        InetGet($arArray[$i][0], $arArray[$i][1], 1, 1)
        While @InetGetActive
            Sleep(100)
            GUICtrlSetData($singleprogress, Round(((@InetGetBytesRead / $size) * 100), 1))
            GUICtrlSetData($multiprogress, Round((((@InetGetBytesRead + $totalread) / $totalsize) * 100), 1))
        WEnd
        $totalread += $size
    Next
    
    GUIDelete($window)
   
EndFunc   ;==>InetGetwithProgress


Dim $list[3][2]
$list[0][0] = "URL1"
$list[0][1] = "PATH1"
$list[1][0] = "URL2"
$list[1][1] = "PATH2"
$list[2][0] = "URL3"
$list[2][1] = "PATH3"

InetGetwithProgressMulti($list)

Well the function expects an array as you can see... And I had to cut out the errorreport, can't really see a clever way to that.

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
Share on other sites

..... Its an example.. change the urls and the path to whatever and run it...

Dim $list[3][2]

$list[0][0] = "URL1"

$list[0][1] = "PATH1"

$list[1][0] = "URL2"

$list[1][1] = "PATH2"

$list[2][0] = "URL3"

$list[2][1] = "PATH3"

InetGetwithProgressMulti($list)

The bottom is an example... Edited by Shevilie

Start here if you are new Valuater's AutoIT 1-2-3Looking for an UDF - Look hereDo you need to do it twice - Autoit

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...