houseonfire Posted December 7, 2008 Share Posted December 7, 2008 (edited) While 1 $Msg = GUIGetMsg() Switch $Msg Case $otherfunction .. Case $start While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Start While ($msg <> $Stop) $msg = GUIGetMsg() ConsoleWrite("Going" & @LF) Sleep(10) Wend ConsoleWrite("STOPPED" & @LF) EndSelect WEnd EndSwitch WEnd When I use this method of stopping a loop using a button, the loop stops but the other buttons on the GUI stop functioning. Can someone help me out? Edited December 7, 2008 by houseonfire Link to comment Share on other sites More sharing options...
Achilles Posted December 7, 2008 Share Posted December 7, 2008 (edited) While 1 $Msg = GUIGetMsg() Switch $Msg Case $otherfunction .. Case $start While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Start While ($msg <> $Stop) $msg = GUIGetMsg() ConsoleWrite("Going" & @LF) Sleep(10) Wend ConsoleWrite("STOPPED" & @LF) EndSelect WEnd EndSwitch WEnd When I use this method of stopping a loop using a button, the loop stops but the other buttons on the GUI stop functioning. Can someone help me out?Instead of the sub loop thing you're using, try using GUICtrlSetState($Start, $GUI_DISABLE)... You'll need a #Include <GUIConstantsEx.au3> for that to work Edited December 7, 2008 by Ichigo My Programs[list][*]Knight Media Player[*]Multiple Desktops[*]Daily Comics[*]Journal[/list] Link to comment Share on other sites More sharing options...
houseonfire Posted December 7, 2008 Author Share Posted December 7, 2008 I'm sorry but I don't see how that is going to help me stop the loop from running. Link to comment Share on other sites More sharing options...
martin Posted December 7, 2008 Share Posted December 7, 2008 (edited) While 1 $Msg = GUIGetMsg() Switch $Msg Case $otherfunction .. Case $start While 1 $msg = GUIGetMsg() Select Case $msg = $GUI_EVENT_CLOSE ExitLoop Case $msg = $Start While ($msg <> $Stop) $msg = GUIGetMsg() ConsoleWrite("Going" & @LF) Sleep(10) Wend ConsoleWrite("STOPPED" & @LF) EndSelect WEnd EndSwitch WEnd When I use this method of stopping a loop using a button, the loop stops but the other buttons on the GUI stop functioning. Can someone help me out?You have no way to get out of the while/wend loop you start after the Case $start line unless $msg = $GUI_EVENT_CLOSE. Add another ExitLoop after ConsoleWrite("STOPPED" & @LF). Edited December 7, 2008 by martin Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
houseonfire Posted December 7, 2008 Author Share Posted December 7, 2008 You have no way to get out of the while/wend loop you start after the Case $start line unless $msg = $GUI_EVENT_CLOSE. Add another ExitLoop after ConsoleWrite("STOPPED" & @LF).Thank you very much. That worked. Link to comment Share on other sites More sharing options...
rasim Posted December 8, 2008 Share Posted December 8, 2008 (edited) houseonfireNot need to use many loops:While 1 $Msg = GUIGetMsg() Switch $Msg Case $otherfunction ; Case $start While ($Msg <> $Stop) $Msg = GUIGetMsg() ConsoleWrite("STOPPED" & @LF) Sleep(10) WEnd EndSwitch WEnd Edited December 8, 2008 by rasim 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