cscottrun Posted August 17, 2019 Share Posted August 17, 2019 I have a fairly long script that sends keyboard and mouse input to do a specific repetitive task within PowerPoint. I made a small GUI that runs along with the script, and I'm updating the labels and edit box of the GUI as the other functions run to get some visual feedback on what's happening. For example it might say "waiting for X to open", or "clicking Y". This part is working well. There is an 'abort' button in the GUI that I would like to interrupt the script when it is not working as expected, and then do some other task like clean up files and start over again. I can't figure out how to do this in such a way that the GUI is still responsive to button clicks even if the non-GUI function is hung up waiting for a a window to become active, etc. Basically I need the GUI's while loop to continue running at the same time that other functions are running. I hope this question makes sense... The GUI portion of my code is below. #Region ### $Form1_1 = GUICreate("", 200, 880, 1070, 0) $Label1 = GUICtrlCreateLabel("", 8, 8, 170, 17) $Label2 = GUICtrlCreateLabel("", 8, 27, 188, 17) $Label3 = GUICtrlCreateLabel("", 8, 44, 188, 17) $Label4 = GUICtrlCreateLabel("", 170, 8, 20, 20, BitOR($SS_CENTER, $SS_CENTERIMAGE, $SS_SUNKEN)) $Label5 = GUICtrlCreateLabel("", 8, 700, 20, 17) Color($COLOR_Green) $Edit1 = GUICtrlCreateEdit("", 8, 64, 185, 625) GUICtrlSetData(-1, "") $Button1 = GUICtrlCreateButton("Abort", 112, 700, 75, 25) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $nMsg = $Button1 ;'Abort' was clicked, take some action ;MsgBox("$MB_OK", "", "bye.") EndSwitch WEND Link to comment Share on other sites More sharing options...
Moderators Melba23 Posted August 17, 2019 Moderators Share Posted August 17, 2019 cscottrun, Welcome to the AutoIt forums. The Interrupting a running function tutorial in the Wiki will explain how to do what you want. M23 cscottrun 1 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