Jump to content

Recommended Posts

Posted (edited)

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
  • Moderators
Posted

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.

Posted

Couldn't you just lower the sleep delay to say, 100, so it checks more often and doesn't spend so much time in the sleep mode?

I do agree that OnEvent mode is a better option, but if he wants to stay in GetMsg mode, that should do it.

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