Jump to content

Update Progress Bar


Go to solution Solved by FireFox,

Recommended Posts

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.

Link to post
Share on other sites
  • Solution

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

 

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. :'(

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
  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...