Jump to content

Problem with "GUICtrlCreateInput"


Anuran
 Share

Recommended Posts

Hello all,

i stuck at "GUICtrlCreateInput" and "GUICtrlRead".

i want to run my loop X times and user can set how many times but something is wrong there :)

it just ignore my input and loop is infinity.

#include <GUIConstants.au3>

Global $Paused

HotKeySet("{ESC}","Quit")
HotKeySet("{ENTER}","Start")
HotKeySet("{PAUSE}","Pause")

$i = 0

Opt("SendKeyDownDelay", 10)

GUICreate("bla",458,350)
GUISetState (@SW_SHOW)

$Input = GUICtrlCreateInput("20",350,150,50)
$num = GUICtrlRead($Input)

Func Start()
    While 1
            Send("{U}")
            Sleep(10)
            Send("{P}")
            Sleep(20000)
        Do
            Send("{2}")
            Sleep(4000)
            Send("{8}")
            Sleep(4000)
            $i = $i + 1
        Until $i = $num

    WEnd
EndFunc

Func Pause()
EndFunc

While 1
Wend

Func Quit()
Edited by Anuran
Link to comment
Share on other sites

i got another problem now :/

my loop just run once and then infinite again.

i want to run my "while loop" > "do - until (x times)" > "while loop" > "do - until (x times)" and all this in a loop.

any ideas?

#include <GUIConstants.au3>

HotKeySet("{ESC}","Quit")
HotKeySet("{ENTER}","Start")
HotKeySet("{PAUSE}","Pause")

$i = 0

Opt("SendKeyDownDelay", 10)

GUICreate("bla",458,350)
GUISetState (@SW_SHOW)

$Input = GUICtrlCreateInput("20",350,150,50)

Func Start()
    While 1
            Send("{U}")
            Sleep(10)
            Send("{P}")
            Sleep(20000)
        Do
            Send("{2}")
            Sleep(4000)
            Send("{8}")
            Sleep(4000)
            $i = $i + 1
            $num = GUICtrlRead($Input)
        Until $i = $num

    WEnd
EndFunc

While 1
Wend

Func Quit()
Link to comment
Share on other sites

#include <GUIConstants.au3>

HotKeySet("{ESC}", "Quit")
HotKeySet("{ENTER}", "Start")
HotKeySet("{PAUSE}", "Pause")

$i = 0
$restart = False
Opt("SendKeyDownDelay", 10)

GUICreate("bla", 458, 350)
GUISetState(@SW_SHOW)

$Input = GUICtrlCreateInput("20", 350, 150, 50)

Func Start()
    While 1
        Send("{U}")
        Sleep(10)
        Send("{P}")
        Sleep(20000)
        Do
            Send("{2}")
            Sleep(4000)
            Send("{8}")
            Sleep(4000)
            $i = $i + 1
            $num = GUICtrlRead($Input)
            If $i = GUICtrlRead($Input) Then
                $i = 0
                $restart =True
            Else
                $restart=False
                EndIf
            
        Until $restart = True

    WEnd
    sleep(50)
EndFunc  ;==>Start

While 1
WEnd

Func Quit()

Link to comment
Share on other sites

same as before, loop just run once. maybe my "$Input = GUICtrlCreateInput" get lost somehow or cant read it twice. is there a re-read function or restart from line XX or something?

EDIT: ok works well with some editing. my real script is a bit bigger than this test script and i was n00b not trying everything. dont judge me ^^ im just a beginner doing his first steps :)

thank you both for help and patience :)

Edited by Anuran
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...