Jump to content

help creating a GUI


gagaga
 Share

Recommended Posts

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?

Link to comment
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

Link to comment
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
 Share

  • Recently Browsing   0 members

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