Jump to content

Question about GUI and loops.


Recommended Posts

Hey people,

So, ive been starting a little script ( I'm quite the newb at the moment=P )

GuiCreate("Version 1.0",471,123,494,283)

$button1=GuiCtrlCreateButton("Start",-3,98,66,29)

$button2=GuiCtrlCreateButton("About",196,98,66,29)

$button3=GuiCtrlCreateButton("Exit",410,98,66,29)

$button4=GUICtrlCreateButton("Windows",100,98,66,29)

$input1=GuiCtrlCreateInput("",196,49,65,20)

$label1=GuiCtrlCreateLabel("How many times to repeat.",190,23,128,15)

GuiSetState()

So, Further down my script i got a part that needs to be in a loop, Can i use my Input tabel to accomplish this?

So when i start my script, the GUI shows. let say, i put down 10 times, and it will loop 10 times, Is this possible? Or will this be to hard for me to understand?:unsure:

Any help is welcome!

Thanks in advance.

Link to comment
Share on other sites

i made this lil script as a basic outline of what i think you wanted,(the stop button may not work very well, or at all) if you have any questions feel free to ask!

#include <GUIConstantsEx.au3>

GuiCreate("Version 1.0",471,123,494,283)
$button1=GuiCtrlCreateButton("Start",-3,98,66,29)
$button2=GuiCtrlCreateButton("About",196,98,66,29)
$button3=GuiCtrlCreateButton("Exit",410,98,66,29)
$button4=GUICtrlCreateButton("Windows",100,98,66,29)
$input1=GuiCtrlCreateInput("",196,49,65,20)
$label1=GuiCtrlCreateLabel("How many times to repeat.",190,23,128,15)
GuiSetState()

While 1
    $nMsg=GUIGetMsg()
    If $nMsg = -3 Then Exit
    If $nMsg = $button1 Then button1()
    If $nMsg = $button2 Then button2()
    If $nMsg = $button3 Then button3()
    If $nMsg = $button4 Then button4()
    $repeat=GUICtrlRead($input1)
WEnd

Func button1()
    $start=0 ;set $start to 0
    If $repeat = "" Or 0 Then ;checks if $repeat = nothing or 0 so it doesn't repeat forever
        MsgBox(0,"Error","please define how many times to repeat next time!")
        Exit ;stops script from repeating forever
    EndIf
    Do
        $start+=1 ;add 1 to $start
        ;stuff
    Until $start = $repeat ;loop until $start = $repeat
EndFunc

Func button2()
    ;somthin here
EndFunc

Func button3()
    Exit
EndFunc

Func button4()
    ;stuff
EndFunc
Edited by pieeater

[spoiler]My UDFs: Login UDF[/spoiler]

Link to comment
Share on other sites

What im doing when i put:

$start=$repeat-$repeat

is im setting the variable $start to 0, wow, lmao i didnt even need to do that, sorry! its the same as:

$start=0

but just for kicks and giggles $repeat-$repeat means that whatever $repeat is its subracting itself, which = 0

so if $repeat = 9 then 9 - 9 = 0

also edit button apperes when you have 5 posts.

Edited by pieeater

[spoiler]My UDFs: Login UDF[/spoiler]

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