Jump to content

Close GUI while "Sleeping"


Cherubim
 Share

Recommended Posts

I have the following problem:

The GUI isnt able to close while Autoit is executing sleep.

Is there a way around this, cause my script uses lots of Sleep funtions?

#region --- GuiBuilder code Start ---
; Script generated by AutoBuilder 0.5 Prototype

#include <GuiConstants.au3>

If Not IsDeclared('WS_CLIPSIBLINGS') Then Global $WS_CLIPSIBLINGS = 0x04000000

GuiCreate("MyGUI", 309, 180,(@DesktopWidth-309)/2, (@DesktopHeight-168)/2 , $WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

$Checkbox_1 = GuiCtrlCreateCheckbox("test", 10, 20, 

GuiSetState()
While 1
    $msg = GuiGetMsg()
    Select
    Case $msg = $GUI_EVENT_CLOSE
        ExitLoop
    Case Else
        Sleep(10000)
    EndSelect
WEnd
Exit
#endregion --- GuiBuilder generated code End ---

Just an example what i meant ;)

Edited by Cherubim
Link to comment
Share on other sites

  • Moderators

You could try using a HotKey, and use an exit option.

HotKeySet("{ESC}", "Terminate")

Func Terminate()

Exit 0

EndFunc

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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...