iownn Posted February 20, 2011 Share Posted February 20, 2011 (edited) 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; GUI GuiCreate("Simple program", 260, 300); INPUTGuiCtrlCreateLabel("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)GUICtrlSetState ($CHECKED, $GUI_UNCHECKED)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)GuiSetState(@SW_SHOW)GUISetOnEvent($GUI_EVENT_CLOSE, "CLOSEClicked")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 aroundWEndFunc CLOSEClicked() ExitEndfuncFunc button1() MsgBox(0, "Nothing", "Nothing")EndFuncFunc button2() MsgBox(0, "Nothing", "Nothing")EndFuncFunc button3() MsgBox(0, "Nothing", "Nothing")EndFuncFunc button4() MsgBox(0, "Nothing", "Nothing")EndFuncFunc button5() MsgBox(0, "Nothing", "Nothing")EndFuncFunc Start() MouseMove(574, 271) MouseClick("left") Sleep (5000)EndFunc Edited February 20, 2011 by iownn Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted February 20, 2011 Moderators Share Posted February 20, 2011 iownn,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. Please come back after you have read the tutorial if you have any questions. M23 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: Spoiler ArrayMultiColSort ---- Sort arrays on multiple columnsChooseFileFolder ---- Single and multiple selections from specified path treeview listingDate_Time_Convert -- Easily convert date/time formats, including the language usedExtMsgBox --------- A highly customisable replacement for MsgBoxGUIExtender -------- Extend and retract multiple sections within a GUIGUIFrame ---------- Subdivide GUIs into many adjustable framesGUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView itemsGUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeViewMarquee ----------- Scrolling tickertape GUIsNoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxesNotify ------------- Small notifications on the edge of the displayScrollbars ----------Automatically sized scrollbars with a single commandStringSize ---------- Automatically size controls to fit textToast -------------- Small GUIs which pop out of the notification area Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now