Cherubim Posted September 12, 2005 Posted September 12, 2005 (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 September 12, 2005 by Cherubim
Moderators SmOke_N Posted September 13, 2005 Moderators Posted September 13, 2005 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.
jpm Posted September 13, 2005 Posted September 13, 2005 You have to use the onEvent mode not the Loop one.
greenmachine Posted September 14, 2005 Posted September 14, 2005 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.
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