gfunk999 Posted September 25, 2007 Share Posted September 25, 2007 Hey Guys, I'm trying to understand loops better. I've been practicing, but it's still a bit fuzzy. Could someone please tell me why my GUI keeps closing after checking any box and clicking OK? All programs launch fine, but I want the GUI to remain open. I tried removing the exitloop line, but then nothing happens. expandcollapse popup#include <GuiConstants.au3> GuiCreate("MyGUI", 392, 316,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Checkbox_1 = GuiCtrlCreateCheckbox("Notepad", 30, 30, 90, 30) $Checkbox_2 = GuiCtrlCreateCheckbox("Calculator", 30, 70, 80, 20) $Checkbox_3 = GuiCtrlCreateCheckbox("Mspaint", 30, 100, 80, 20) $Checkbox_4 = GuiCtrlCreateCheckbox("Explorer", 30, 130, 80, 20) $Button_3 = GuiCtrlCreateButton("OK", 278, 112, 65, 29) GuiSetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $Button_3 ExitLoop EndSelect Wend if $msg = -3 Then Exit EndIf If GUICtrlRead($Checkbox_1) = $GUI_CHECKED Then Run("Notepad.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_2) = $GUI_CHECKED Then Run("Calc.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_3) = $GUI_CHECKED Then Run("Mspaint.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_4) = $GUI_CHECKED Then Run("explorer.exe", "", @SW_MAXIMIZE) EndIf Exit Link to comment Share on other sites More sharing options...
BigDod Posted September 25, 2007 Share Posted September 25, 2007 #include <GuiConstants.au3> GUICreate("MyGUI", 392, 316, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Checkbox_1 = GUICtrlCreateCheckbox("Notepad", 30, 30, 90, 30) $Checkbox_2 = GUICtrlCreateCheckbox("Calculator", 30, 70, 80, 20) $Checkbox_3 = GUICtrlCreateCheckbox("Mspaint", 30, 100, 80, 20) $Checkbox_4 = GUICtrlCreateCheckbox("Explorer", 30, 130, 80, 20) $Button_3 = GUICtrlCreateButton("OK", 278, 112, 65, 29) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $Button_3 If GUICtrlRead($Checkbox_1) = $GUI_CHECKED Then Run("Notepad.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_2) = $GUI_CHECKED Then Run("Calc.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_3) = $GUI_CHECKED Then Run("Mspaint.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_4) = $GUI_CHECKED Then Run("explorer.exe", "", @SW_MAXIMIZE) EndIf EndSelect WEnd Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
gfunk999 Posted September 25, 2007 Author Share Posted September 25, 2007 No doubt action speaks louder than words. You made it clear...I had to keep the gui reads inside the loop, until something breaks the loop. Thank you BigDOD! #include <GuiConstants.au3> GUICreate("MyGUI", 392, 316, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Checkbox_1 = GUICtrlCreateCheckbox("Notepad", 30, 30, 90, 30) $Checkbox_2 = GUICtrlCreateCheckbox("Calculator", 30, 70, 80, 20) $Checkbox_3 = GUICtrlCreateCheckbox("Mspaint", 30, 100, 80, 20) $Checkbox_4 = GUICtrlCreateCheckbox("Explorer", 30, 130, 80, 20) $Button_3 = GUICtrlCreateButton("OK", 278, 112, 65, 29) GUISetState() $msg = 0 While $msg <> $GUI_EVENT_CLOSE $msg = GUIGetMsg() Select Case $msg = $Button_3 If GUICtrlRead($Checkbox_1) = $GUI_CHECKED Then Run("Notepad.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_2) = $GUI_CHECKED Then Run("Calc.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_3) = $GUI_CHECKED Then Run("Mspaint.exe", "", @SW_MAXIMIZE) EndIf If GUICtrlRead($Checkbox_4) = $GUI_CHECKED Then Run("explorer.exe", "", @SW_MAXIMIZE) EndIf EndSelect WEnd 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