Sign in to follow this  
Followers 0
B3EAST

Progress bar frustration

3 posts in this topic

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

Share this post


Link to post
Share on other sites



Why do you have this test?:

If GUICtrlRead($Prog1) = $Time Then
   MsgBox(0,"DONE","Done")
   Exit
EndIf
You 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

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites

thanks so much.. That was driving me nuts

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