Jump to content
Sign in to follow this  
Darklord2000

loop script prob

Recommended Posts

Darklord2000

How can i get a script to loop a x amount of time where x=a number entered into the gui in a input field? I did a search but cant find maybe im looking in the wrong place. If any can tell me where i can get the information at or give me the information that would be great.

Share this post


Link to post
Share on other sites
botanic

$x = imputbox(...)

for $i = 0 to $x

;stuff

next

Share this post


Link to post
Share on other sites
covaks

So you just want to read from an inputbox, and create a loop that executes that many times?

#include <GuiConstants.au3>

GUICreate("")
$Input = GUICtrlCreateInput("",5,5)
$Button = GUICtrlCreateButton("Loop",5,30)
GUISetState()

While 1
    $msg = GUIGetMsg()
    
    Switch $msg
        Case $GUI_EVENT_CLOSE
            ExitLoop
        Case $Button
            $num = GUICtrlRead($Input)
            If StringRegExp($num,"^[0-9]+$") Then ; Make sure only numbers were entered into the inputbox
                For $x = 0 to $num 
                    msgbox(1,"",$x)
                Next
            EndIf
    EndSwitch
WEnd

Share this post


Link to post
Share on other sites
Darklord2000

question but where would i input my script into?

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  

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.