Jump to content

Recommended Posts

Posted

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.

Posted

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

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...