stibbar Posted March 7, 2007 Posted March 7, 2007 Well I have searched the forums for a while now before actually posting and either I suck at searching (which is probably true) or there is nothing on what I about to ask. What I have made is a GUI that has 3 radio buttons and 1 Button that when checked and the "OK" button is clicked it will run the correct program depending on what is was selected via the radio buttons. Now the way I have it setup works, but if you miss selecting a radio button it still runs the command I have told it to.What I am trying to do is make it so that a radio button in each group has to be selected or it will not run. I have tried using some Boolean expressions but that did not work for me. This is what I have at this point.CODE#include <GuiConstants.au3>GuiCreate("Citrix One Step Install", 350, 585,-1, -1 , BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS))$Radio_1 = GuiCtrlCreateRadio("32 Bit", 50, 15, 100, 30)$Radio_2 = GuiCtrlCreateRadio("64 Bit", 170, 15, 100, 30)$Group_3 = GuiCtrlCreateGroup("OS bit Version", 10, 0, 280, 50)$Radio_4 = GuiCtrlCreateRadio("Windows 2000", 50, 70, 100, 30)$Radio_5 = GuiCtrlCreateRadio("Windows 2003", 170, 70, 100, 30)$Group_6 = GuiCtrlCreateGroup("OS Type", 10, 50, 280, 60)$Radio_7 = GuiCtrlCreateRadio("bldg1", 30, 130, 110, 30)$Radio_8 = GuiCtrlCreateRadio("bldg2", 30, 160, 110, 30)$Radio_9 = GuiCtrlCreateRadio("bldg3", 30, 190, 110, 30)$Radio_10 = GuiCtrlCreateRadio("bldg4", 30, 220, 110, 30)$Group_11 = GuiCtrlCreateGroup("Zone", 10, 110, 140, 290)$Button_12 = GuiCtrlCreateButton("OK", 100, 480, 150, 30)GUICtrlCreateLabel("Please verify your settings and press OK", 60, 420,250,30)GuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $Radio_1 case $msg = $Radio_4 Case $msg = $Radio_7 Case $msg = $Button_12 Run ("notepad.exe", "") Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelectWEndExitI have also tried the following but this didn't work either.CODEGuiSetState()While 1 $msg = GuiGetMsg() Select Case $msg = $Radio_1 And $msg = $Radio_4 And $msg = $Radio_7 And $msg = $Button_12 Run ("notepad.exe", "") Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelectWEndExitI would love some direction form you folks and it would much appreciated. I am new to this (if you could not tell ) and trying to learn as I go but it seems the going is slow.Thanks muchStibbar
Valuater Posted March 7, 2007 Posted March 7, 2007 Maybe... expandcollapse popup; temporary script #include <GuiConstants.au3> Dim $Radio_[9] GUICreate("Citrix One Step Install", 350, 585, -1, -1, BitOR($WS_OVERLAPPEDWINDOW, $WS_CLIPSIBLINGS)) $Radio_[1] = GUICtrlCreateRadio("32 Bit", 50, 15, 100, 30) GUICtrlSetState( -1, $GUI_CHECKED) $Radio_[2] = GUICtrlCreateRadio("64 Bit", 170, 15, 100, 30) $Group_1 = GUICtrlCreateGroup("OS bit Version", 10, 0, 280, 50) $Radio_[3] = GUICtrlCreateRadio("Windows 2000", 50, 70, 100, 30) If @OSVersion = "WIN_2000" Then GUICtrlSetState( -1, $GUI_CHECKED) $Radio_[4] = GUICtrlCreateRadio("Windows 2003", 170, 70, 100, 30) If @OSVersion = "WIN_2003" Then GUICtrlSetState( -1, $GUI_CHECKED) $Group_2 = GUICtrlCreateGroup("OS Type", 10, 50, 280, 60) $Radio_[5] = GUICtrlCreateRadio("bldg1", 30, 130, 110, 30) GUICtrlSetState( -1, $GUI_CHECKED) $Radio_[6] = GUICtrlCreateRadio("bldg2", 30, 160, 110, 30) $Radio_[7] = GUICtrlCreateRadio("bldg3", 30, 190, 110, 30) $Radio_[8] = GUICtrlCreateRadio("bldg4", 30, 220, 110, 30) $Group_3 = GUICtrlCreateGroup("Zone", 10, 110, 140, 290) $Button_12 = GUICtrlCreateButton("OK", 100, 480, 150, 30) GUICtrlCreateLabel("Please verify your settings and press OK", 60, 420, 250, 30) GUISetState() While 1 $msg = GUIGetMsg() Select Case $msg = $Radio_[1] Case $msg = $Radio_[4] Case $msg = $Radio_[7] Case $msg = $Button_12 Run("notepad.exe", "") WinWaitActive("") for $x = 1 to UBound($Radio_) -1 If BitAnd(GUICtrlRead($Radio_[$x]),$GUI_CHECKED) = $GUI_CHECKED Then ;do this or that Send("Checkbox " & $x & " was selected" & @CRLF) EndIf Next Case $msg = $GUI_EVENT_CLOSE ExitLoop Case Else ;;; EndSelect WEnd Exit Exit Func OnAutoItStart() If WinExists(@ScriptName & '_Interpreter') Then Exit AutoItWinSetTitle(@ScriptName & '_Interpreter') EndFunc ;==>OnAutoItStart 8)
stibbar Posted March 8, 2007 Author Posted March 8, 2007 Valuater thanks for the help and but it still will run the application even though all the radio buttons are not checked. I noticed the "If @OSVersion" and that is awesome. I guess I am looking for a way that all the zones have to have an entry before it will launch. Is it possible to use boolean with the Case statement? I have looked at the autoit help file but that shows no examples. Again thanks for the help. Stibbar
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