Jump to content
Sign in to follow this  
ileandros

ProgressBar for InetGet()

Recommended Posts

ileandros

Hello,

Just made this little script for a project and thought of sharing it with you.

Hope it will help someone.

$size = InetGetSize ( "http://downloads.myeclipseide.com/downloads/products/mobione/2.X/MobiOne_2.3.1_Installer.exe")
$TotalSize = Round($size / 1024)
ConsoleWrite("Total size in KB/s is: " & $TotalSize & "KB/s " & @CRLF)
$dl = INetGet("http://downloads.myeclipseide.com/downloads/products/mobione/2.X/MobiOne_2.3.1_Installer.exe",@DesktopDir & "\test.exe",1,1)
ProgressOn("Download ProgressBar", "Download progress in KB/s")
Do
$sec = @SEC
$Bytes = Round(InetGetInfo($dl,0))
While @SEC = $sec
Sleep(10)
WEnd
$CalBytes = Round(InetGetInfo($dl,0))
$TotalSize = $TotalSize - (($CalBytes - $Bytes) /1024)
$Percentage = Round($TotalSize / $size * 100000)
$Percentage = 100 - $Percentage
ConsoleWrite($TotalSize & "KB/s" & @CRLF & $Percentage & "%" & @CRLF)
ProgressSet($Percentage)
Until InetGetInfo($dl,2)
ProgressOff()

Edit: This on is with progessbar on a gui for people that are not familiar with autoit

#include <GUIConstantsEx.au3>
$size = InetGetSize ( "http://downloads.myeclipseide.com/downloads/products/mobione/2.X/MobiOne_2.3.1_Installer.exe")
$TotalSize = Round($size / 1024)
ConsoleWrite("Total size in KB/s is: " & $TotalSize & "KB/s " & @CRLF)
$dl = INetGet("http://downloads.myeclipseide.com/downloads/products/mobione/2.X/MobiOne_2.3.1_Installer.exe",@DesktopDir & "\test.exe",1,1)
$hGUI = GUICreate("ProgressBar", 200,100)
$probar = GUICtrlCreateProgress(10,60,180,25)
GUISetState()
Do
$sec = @SEC
$Bytes = Round(InetGetInfo($dl,0))
While @SEC = $sec
Sleep(10)
If GUIGetMsg() = $GUI_EVENT_CLOSE Then Exit
WEnd
$CalBytes = Round(InetGetInfo($dl,0))
$TotalSize = $TotalSize - (($CalBytes - $Bytes) /1024)
$Percentage = Round($TotalSize / $size * 100000)
$Percentage = 100 - $Percentage
ConsoleWrite($TotalSize & "KB/s" & @CRLF & $Percentage & "%" & @CRLF)
GUICtrlSetData($probar,$Percentage)
Until InetGetInfo($dl,2)
Edited by ileandros

I feel nothing.It feels great.

Share this post


Link to post
Share on other sites
lorenkinzel

Do you get AdHits for GarenaPlus? muttley

Otherwise, I like it.

Share this post


Link to post
Share on other sites
ileandros

Ok i just changed the url because i didn't like it.

I don't even know what garena is btw. Just found a "random url" with 20+mb.

I wanted to test it with high bytes items thats why i added that link.

Hope this link now is not that much popular ;)


I feel nothing.It feels great.

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  

×