Sign in to follow this  
Followers 0
Champak

ControlSetText

5 posts in this topic

#1 ·  Posted (edited)

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

Share this post


Link to post
Share on other sites



iif this is within your own script... it is the hard way

use

guictrlread()

guictrlsetdata

8)


NEWHeader1.png

Share this post


Link to post
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


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

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

Share this post


Link to post
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.


Get Beta versions Here Get latest SciTE editor Here AutoIt 1-2-3 by Valuater - A great starting point.

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

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