Sign in to follow this  
Followers 0
antmar904

Update Progress Bar

7 posts in this topic

Ive been trying for a couple of day to update a progress bar that i have in my gui but i just cant seem to get it working.

i am sure that this function needs more improvment also.

some lines where copied from other scripts (thank you)

here is what i have:

Func _Update()
      Local $FileSize
      Local $url = "http://downloads.sophos.com/tools/sav32sfx.exe" ;Set URL
      Local $folder = @ScriptDir & "\files\CLI\sav32sfx.exe" ;Set folder
      Local $hInet = InetGet($url, $folder, 1, 1) ;Forces a reload from the remote site and return immediately and download in the background
      While Not InetGetInfo($hInet, 2) ;Loop until download is finished
      Sleep(500) ;Sleep for half a second to avoid flicker in the progress bar
      GUICtrlSetData($lblUpdating, "Downloading CLI")
      Local $BytesReceived = InetGetInfo($hInet, 0) ;Get bytes received
      Local $Pct = Int($BytesReceived / $FileSize * 100) ;Calculate percentage
      GUICtrlSetData($Progress1, $Pct & "%") ;Trys to update progress bar   
      WEnd
      GUICtrlSetData($lblUpdating, "")
   EndFunc

thanks in advance.

Share this post


Link to post
Share on other sites



Hi,

I see that the $FileSize var is never assigned.

Br, FireFox.


 

OS : Win XP SP2 (32 bits) / Win 7 SP1 (64 bits) / Win 8 (64 bits) | Autoit version: latest stable / beta.
Hardware : Intel(R) Core(TM) i5-2400 CPU @ 3.10Ghz / 8 GiB RAM DDR3.

My UDFs : Skype UDF | TrayIconEx UDF | GUI Panel UDF | Excel XML UDF | Is_Pressed_UDF

My Projects : YouTube Multi-downloader | FTP Easy-UP | Lock'n | WinKill | AVICapture | Skype TM | Tap Maker | ShellNew | Scriptner | Const Replacer | FT_Pocket | Chrome theme maker

My Examples : Capture toolIP Camera | Crosshair | Draw Captured Region | Picture Screensaver | Jscreenfix | Drivetemp | Picture viewer

My Snippets : Basic TCP | Systray_GetIconIndex | Intercept End task | Winpcap various | Advanced HotKeySet | Transparent Edit control

 

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

GUICtrlSetData($Progress1, $Pct)

maybe ? surely :)

and division by zero => Firefox

Edited by Edano

[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

oooops

Local $FileSize = InetGetSize($url)

Thanks for the quick response ! :thumbsup:

Share this post


Link to post
Share on other sites

Division by zero?  Edano, you must be almost as old as I am!  The younger, digital crowd don't understand we analogs, and they have never heard of division by zero errors.  All that's ok, they have black and white (digital, binary), we have all the colors of the rainbow (analog)!


Meds.  They're not just for breakfast anymore. :'(

Share this post


Link to post
Share on other sites

is division by zero allowed meanwhile ? :)  you never know. times are a'changing.


[color=rgb(255,0,0);][font="'comic sans ms', cursive;"]FukuLeaks[/color][/font]

Share this post


Link to post
Share on other sites

Methematically, division by zero is undefined.  But, then again, infinity minus infinity is infinity, go figure.


Meds.  They're not just for breakfast anymore. :'(

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