Jump to content

ControlSetText


Champak
 Share

Recommended Posts

Basically I have a GUi, and the script loops. What this is suppose to do is read the number in the label then increase by one then set the new number in that label. The reason I'm doing it like this instead of a regular progress counter is because if the loop is stopped and then started again, the progress will be reset. Where this way it will see where it last left off. But it wont increase, it stays at one. Some help please. Thanks.

$Progress_Value = ControlCommand($Title, $Text, 15, "GetLine", "")
        $Progress = $Progress_Value + 1
        ControlSetText($Title, $Text, 15, $Progress)
Edited by Champak
Link to comment
Share on other sites

Poor example

#include <GUIConstants.au3>

Global $Paused
HotKeySet("{PAUSE}", "TogglePause")
HotKeySet("{ESC}", "Terminate")

$Form1 = GUICreate("AForm1", 334, 137, 193, 115)
$Label1 = GUICtrlCreateLabel("1", 88, 32, 20, 28)
GUICtrlSetFont(-1, 14, 400, 0, "MS Sans Serif")
GUISetState(@SW_SHOW)

for $i = 1 to 100
            $a = GUICtrlRead($Label1)
            $a = $a + 1
            GUICtrlSetData($Label1, $a)
            Sleep(500)
Next

Func TogglePause()
    $Paused = NOT $Paused
    While $Paused
        sleep(100)
    WEnd
EndFunc

Func Terminate()
    Exit 0
EndFunc


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

Thanks but neither of those solutions works.

It is within a seporate script, that's why I have to use control command.

Are you saying poor example because I don't have more? If so here you go.

$looping = ControlCommand($Title, $Text, 14, "GetLine", "") ;loop value
    For $a = 1 To $looping
        $perc = Int($a / $looping * 100)
        ControlSetText($Title, $Text, 20, $perc & "%")      
                $Progress_Value = ControlCommand($Title, $Text, 15, "GetLine", "")
                $Progress = $Progress_Value + 1
                ControlSetText($Title, $Text, 15, $Progress)

                (BLAH BLAH BLAH BLAH script)

        Next

The rest of the script is very long and nothing to do with this one part.

Thanks.

EDIT: Note so you understand: If I take out the "$Progress_Value = ControlCommand($Title, $Text, 15, "GetLine", "")", it counts up just fine. If I leave it in, it the value in the label stays at 1.

Edited by Champak
Link to comment
Share on other sites

Are you saying poor example because I don't have more?

I was actually stating that the example that I gave was a poor example.


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

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