Sign in to follow this  
Followers 0
gagaga

help creating a GUI

2 posts in this topic

Hey, I was wondering how could I create a GUI like this:

Theres a label and 2 buttons (start and stop button)

The user enters an amount (like 5) in to the label and presses start, then then the script repeats the loop the amount of times and stops.

Any help? I'm new to autoit, tried to search for answers but couldn't find any

or which functions should I use?

Share this post


Link to post
Share on other sites



gagaga

Example:

#include <GuiConstantsEx.au3>
#include <EditConstants.au3>

$hGUI = GUICreate("Test Script", 200, 100)

$input = GUICtrlCreateInput("", 50, 20, 100, 20, $ES_NUMBER)

$StartButton = GUICtrlCreateButton("Start", 11, 69, 75, 23)

$StopButton = GUICtrlCreateButton("Stop", 115, 69, 75, 23)

GUISetState(@SW_SHOW, $hGUI)

While 1
    $msg = GUIGetMsg()
    Switch $msg
        Case $GUI_EVENT_CLOSE
            Exit
        Case $StartButton
            $count = GUICtrlRead($input)
            If $count > 0 Then _MyFunc($count)
    EndSwitch
WEnd

Func _MyFunc($sCount)
    Local $i
    
    For $i = 1 To $sCount
        If GUIGetMsg() = $StopButton Then Return False
        ConsoleWrite($i & @LF)
    Next
EndFunc

:P

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