Jump to content
Sign in to follow this  

Trouble with GUI

Recommended Posts


How do I make Autoit to recieve GUI commands while the script is doing something else? I mean like, my GUI doesn't respond when I click close at the same time as it's doing a function, else if I click close when it's at its IDLE state it works.

#include <GuiConstantsEx.au3>

#include <ButtonConstants.au3>

#include <SliderConstants.au3>

#include <StaticConstants.au3>

#include <WindowsConstants.au3>

#include <EditConstants.au3>

Opt ("mustdeclarevars", 1)

Opt("GUIOnEventMode", 1)

Global $msg


GuiCreate("Simple program", 260, 300)


GuiCtrlCreateLabel("Name:", 0, 12)

GuiCtrlCreateLabel("Age:", 0, 32)

GuiCtrlCreateLabel("Birth date:", 0, 52)

GuiCtrlCreateLabel("Country:", 0, 72)

GuiCtrlCreateLabel("City:", 0, 92)

GuiCtrlCreateLabel("Nationality:", 0, 117)

GuiCtrlCreateLabel("Sex:", 0, 142)

Global $Name = GuiCtrlCreateInput("", 70, 10, 100, 20)

Global $Age= GuiCtrlCreateInput("", 70, 30, 100, 20)

Global $Birth = GuiCtrlCreateInput("", 70, 50, 100, 20)

Global $Country = GuiCtrlCreateInput("1", 70, 70, 100, 20)

Global $City= GuiCtrlCreateInput("1", 70, 90, 100, 20)

Global $Nationality = GUICtrlCreateSlider(70, 115, 100, 20)

GUICtrlSetLimit ($Nationality, 3)

GUICtrlSetData ($Nationality, 1)

Global $Sex = GuiCtrlCreateInput("15000",70, 140, 100, 20)

Global $CHECKED = GuiCtrlCreateCheckbox("Yes", 180, 10, 80, 20)


Global $button = GUICtrlCreateButton ("?", 180, 115, 25, 20)

Global $button2 = GUICtrlCreateButton ("?", 180, 140, 25, 20)

Global $button3 = GUICtrlCreateButton ("?", 180, 70, 25, 20)

Global $button4 = GUICtrlCreateButton ("?", 180, 93, 25, 20)

Global $button5 = GUICtrlCreateButton ("How to use?", 90, 190, 80, 40)

Global $Start = GUICtrlCreateButton ("Start", 205, 280, 55, 20)

Global $Close = GUICtrlCreateButton ("Close", 0, 280, 55, 20)



GUICtrlSetOnEvent($start, "Start")

GUICtrlSetOnEvent($Close, "CLOSEClicked")

GUICtrlSetOnEvent($button, "button1")

GUICtrlSetOnEvent($button2, "button2")

GUICtrlSetOnEvent($button3, "button3")

GUICtrlSetOnEvent($button4, "button4")

GUICtrlSetOnEvent($button5, "button5")

While 1

Sleep(1000) ; Idle around


Func CLOSEClicked()



Func button1()

MsgBox(0, "Nothing", "Nothing")


Func button2()

MsgBox(0, "Nothing", "Nothing")


Func button3()

MsgBox(0, "Nothing", "Nothing")


Func button4()

MsgBox(0, "Nothing", "Nothing")


Func button5()

MsgBox(0, "Nothing", "Nothing")


Func Start()

MouseMove(574, 271)


Sleep (5000)


Edited by iownn

Share this post

Link to post
Share on other sites


Welcome to the AutoIt forum. :)

I suggest reading the Interrupting a running function tutorial in the Wiki - it will explain why your GUI becmes unresponsive and how you can use a number of methods to break into the function. :idiot:

Please come back after you have read the tutorial if you have any questions. ;)


Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:


ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area


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