B3EAST Posted December 5, 2009 Share Posted December 5, 2009 My progress bar only does 3/4 of the bar and then it says it is finished. I am pretty sure this should work but the only thing i can think of is my formula is wrong for the calculation but dont see it. any help plz. #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Global $Time = InputBox(""," Type time in minutes needed for amount" & @CRLF & @CRLF & "Default is for 2 minutes",2) * 60 GUICreate("timer count up",300,100) $Prog1 = GUICtrlCreateProgress(10,10,200,20) GUICtrlSetColor(-1, 32250) $button1 = GUICtrlCreateButton("Start", 75, 70, 70, 20) GUISetState() $wait = 1000 ;time delay in seconds Do $msg = GUIGetMsg() If $msg = $button1 Then For $i = 0 To $Time GUICtrlSetData($Prog1,$i / $Time *100) Sleep($wait) If GUICtrlRead($Prog1) = $Time Then MsgBox(0,"DONE","Done") Exit EndIf Next EndIf Sleep(20) Until $msg = $GUI_EVENT_CLOSE Link to comment Share on other sites More sharing options...
Developers Jos Posted December 5, 2009 Developers Share Posted December 5, 2009 Why do you have this test?: If GUICtrlRead($Prog1) = $Time Then MsgBox(0,"DONE","Done") Exit EndIfYou compare the entered time against the percentatge the progressbar is set to which is 0-100. Think this should do what you want: #include <GUIConstantsEx.au3> #include <ProgressConstants.au3> Global $Time = InputBox("", " Type time in minutes needed for amount" & @CRLF & @CRLF & "Default is for 2 minutes", 2) * 60 GUICreate("timer count up", 300, 100) $Prog1 = GUICtrlCreateProgress(10, 10, 200, 20) GUICtrlSetColor(-1, 32250) $button1 = GUICtrlCreateButton("Start", 75, 70, 70, 20) GUISetState() $wait = 1000 ;time delay in seconds Do $msg = GUIGetMsg() If $msg = $button1 Then For $i = 0 To $Time GUICtrlSetData($Prog1, $i / $Time * 100) Sleep($wait) Next MsgBox(0, "DONE", "Done") Exit EndIf Sleep(20) Until $msg = $GUI_EVENT_CLOSE 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...
B3EAST Posted December 6, 2009 Author Share Posted December 6, 2009 thanks so much.. That was driving me nuts 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