Sign in to follow this  
Followers 0
Darklord2000

loop script prob

7 posts in this topic

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



$x = imputbox(...)

for $i = 0 to $x

;stuff

next

Share this post


Link to post
Share on other sites

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

yes thnx

Share this post


Link to post
Share on other sites

question but where would i input my script into?

Share this post


Link to post
Share on other sites

question but where would i input my script into?

Into SciTE.

:)


Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law

Share this post


Link to post
Share on other sites

i mean into that script by covaks

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