LoadStar Posted December 12, 2013 Share Posted December 12, 2013 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 More sharing options...
markyrocks Posted December 12, 2013 Share Posted December 12, 2013 (edited) I was wrong sry. Edited December 12, 2013 by markyrocks Spoiler "I Believe array math to be potentially fatal, I may be dying from array math poisoning" Link to comment Share on other sites More sharing options...
Developers Solution Jos Posted December 12, 2013 Developers Solution Share Posted December 12, 2013 (edited) 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 December 12, 2013 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 More sharing options...
LoadStar Posted December 12, 2013 Author Share Posted December 12, 2013 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 Awesome! This works! Thank you! Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now