Jump to content

GUI interaction with other functions

Recommended Posts

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)
$Edit1 = GUICtrlCreateEdit("", 8, 64, 185, 625)
GUICtrlSetData(-1, "")
$Button1 = GUICtrlCreateButton("Abort", 112, 700, 75, 25)
#EndRegion ### END Koda GUI section ###

While 1
    $nMsg = GUIGetMsg()

    Switch $nMsg
        Case $GUI_EVENT_CLOSE
        Case $nMsg = $Button1 ;'Abort' was clicked, take some action
            ;MsgBox("$MB_OK", "", "bye.")




Link to post
Share on other sites
  • Moderators


Welcome to the AutoIt forums.

The Interrupting a running function tutorial in the Wiki will explain how to do what you want.



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


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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...