Sign in to follow this  
Followers 0
TwilightN3ro

Question about GUI and loops.

6 posts in this topic

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.

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites

Thank you very much, I just started today so i dont quite understand it all yet, But i'll try to figure it all out tonight or tomorrow, If i have any questions ill post them, Thanks alot! :unsure:

Share this post


Link to post
Share on other sites

Sorry for double post, Can't find the edit button? :unsure:

Thanks alot its working :>, could u only explain me what this does,

$start=$repeat-$repeat

$start=$repeat i get but what does -$repeat means?

Thanks alot for your help^^

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

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]

Share this post


Link to post
Share on other sites

Ah yes! Thank you so much, I get it now^^

Its all working now :unsure:

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