Jump to content
Sign in to follow this  
Luig

Progress Bar Problem

Recommended Posts

Luig

I need a progress bar for something like this.

Global $varA = 1

While $varA <= GUICtrlRead($RunNumber)      ;Run Loop


            $varA = $varA + 1       ;Run Loop Accumulator

            If BitAND(GUICtrlRead($EnableRelog), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($EnableHMode), $GUI_CHECKED) = $GUI_CHECKED Then
                Call ("AtLobby")
            EndIf

            If BitAND(GUICtrlRead($EnableRelog), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($EnableSCMode), $GUI_CHECKED) = $GUI_CHECKED Then
                Call ("AtLobbySCM")
            EndIf


            If BitAND(GUICtrlRead($EnableSCMode), $GUI_CHECKED) = $GUI_CHECKED Then
            Call ("DecisionSCM")
        Else
            Call ("Decision")
        EndIf

    WEnd

        Call ("Stop")
    EndIf

That's the piece of my code where I set a runs vs infinate mode. I need to make a progress bar on the Runs part of it. When not in infinate mode you have to specify a number of runs, How can I make a progress bar that shows the progress of $VarA Reaching $RunNumber? In other words I want to show the progress of the runs. Since $RunNumber is an input box it isn't a static variable so I have been trying to break my head open for a while trying to figure this out.

Share this post


Link to post
Share on other sites
ResNullius

Hi luig,

First of all, welcome to the forums :)

This is for a pop-up progress bar, but you could adapt for a GUI based progress bar:

Global $varA = 1

ProgressOn("Runs", "") ;<<<<< Start the progress bar
$iNumberOfRuns = GUICtrlRead($RunNumber)

While $varA <=  $iNumberOfRuns ;Run Loop

  ProgressSet(($varA / $iNumberOfRuns) * 100, ($varA / $iNumberOfRuns) * 100 & "% complete", "") ; <<<<< update 

  $varA = $varA + 1 ;Run Loop Accumulator

  If BitAND(GUICtrlRead($EnableRelog), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($EnableHMode), $GUI_CHECKED) = $GUI_CHECKED Then
    Call("AtLobby")
  EndIf

  If BitAND(GUICtrlRead($EnableRelog), $GUI_UNCHECKED) = $GUI_UNCHECKED And BitAND(GUICtrlRead($EnableSCMode), $GUI_CHECKED) = $GUI_CHECKED Then
    Call("AtLobbySCM")
  EndIf


  If BitAND(GUICtrlRead($EnableSCMode), $GUI_CHECKED) = $GUI_CHECKED Then
    Call("DecisionSCM")
  Else
    Call("Decision")
  EndIf

WEnd
ProgressOff() ; <<< Close the progress Bar

Call("Stop")
EndIf

By the way, you don't need to use "Call" for calling your functions, you can just call them:

instead of Call("AtLobby"), do AtLobby()

Edit: Fixed code to use a variable ($iNumberOfRuns) that represented the value read from $RunNumber Control

Edited by ResNullius

Share this post


Link to post
Share on other sites
Luig

Thank you, Also how do I compile my script and make it keep its bg?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.