Jump to content

Progress bar and Percentages.


LoadStar
 Share

Go to solution Solved by Jos,

Recommended Posts

I am attempting to make a progress bar that counts down each second. My problem comes when the numbers are larger than 100. I understand that the maximum value of the progressbar is 100.

Here is a sample of what I have:

$sTime = GUICtrlCreateInput("", 270, 70, 51, 21, 0x2000)

Func _progressbar()
   $time = GUICtrlRead($sTime)
   GUICtrlSetData($Progress1, 100)
   For $i = 0 to 100
      GUICtrlSetData($Progress1, $i)
      Sleep(1000)
   Next
EndFunc ; _progressbar()

I've been looking up lots of equations to try to get $time = 100 and get the interval it increases by = to 5/$time. In the end it still ends up being $time, of course. Is there something I am missing?

Link to comment
Share on other sites

  • Developers
  • Solution

Something like this?:

$sTime = GUICtrlCreateInput("", 270, 70, 51, 21, 0x2000)

Func _progressbar()
   $time = GUICtrlRead($sTime)
   GUICtrlSetData($Progress1, 100)
   For $i = $Time to 0 step -1
      GUICtrlSetData($Progress1, 100/$time*$i)
      Sleep(1000)
   Next
EndFunc ; _progressbar()

Jos

Edited by Jos

SciTE4AutoIt3 Full installer Download page   - Beta files       Read before posting     How to post scriptsource   Forum etiquette  Forum Rules 
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

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...