ned98 Posted April 20, 2010 Share Posted April 20, 2010 (edited) How can I set multiple conditions for IF?Here's my problem: I need that only if a checkbox and a radio button are selected, a button can close the program.Here's my incorrect code:While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox (0, "TEST", "Message Text.") Case $STUPIDBUTTON If $Radio1 = 1 Then MsgBox(0, "ERRORE", "abc...") ElseIf $Checkbox1 = 1 Then MsgBox (0, "TEST", "TEST COMPLETED.") Then Exit EndIf EndSwitch WEnd Edited April 20, 2010 by ned98 Link to comment Share on other sites More sharing options...
AdmiralAlkex Posted April 20, 2010 Share Posted April 20, 2010 (edited) As the helpfile say:The expression can contain the boolean operators of AND, OR, and NOT as well as the logical operators <, <=, >, >=, =, ==, and <> grouped with parentheses as needed.If $something1 = 1 and $something2 = 2 thenexitendifOr something like that Edit: Oh and Welcome to the forum! Edited April 20, 2010 by AdmiralAlkex .Some of my scripts: ShiftER, Codec-Control, Resolution switcher for HTC ShiftSome of my UDFs: SDL UDF, SetDefaultDllDirectories, Converting GDI+ Bitmap/Image to SDL Surface Link to comment Share on other sites More sharing options...
GEOSoft Posted April 20, 2010 Share Posted April 20, 2010 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox (0, "TEST", "Message Text.") Case $STUPIDBUTTON If GUICtrlRead($Radio1) = 1 Then MsgBox(0, "ERRORE", "abc...") If GUICtrlRead($Checkbox1) = 1 Then MsgBox (0, "TEST", "TEST COMPLETED.") Then Exit Else ContinueLoop EndIf EndSwitch WEnd oapjr 1 George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ned98 Posted April 20, 2010 Author Share Posted April 20, 2010 While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox (0, "TEST", "Message Text.") Case $STUPIDBUTTON If GUICtrlRead($Radio1) = 1 Then MsgBox(0, "ERRORE", "abc...") If GUICtrlRead($Checkbox1) = 1 Then MsgBox (0, "TEST", "TEST COMPLETED.") Then Exit Else ContinueLoop EndIf EndSwitch WEnd thank you very much for your prompt reply! But there's another little problem: when I select the radio button and the checkbox, then press the STUPIDBUTTON, Two windows pop-up: the first - MsgBox(0, "ERRORE", "abc...")- and the second - MsgBox (0, "TEST", "TEST COMPLETED." -. How can I solve this? Link to comment Share on other sites More sharing options...
GEOSoft Posted April 20, 2010 Share Posted April 20, 2010 (edited) Is this what you want? While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox (0, "TEST", "Message Text.") Case $STUPIDBUTTON If GUICtrlRead($Radio1) = 1 AND GUICtrlRead($Checkbox1) = 1 Then MsgBox (0, "TEST", "TEST COMPLETED.") Then Exit Else MsgBox(0, "ERRORE", "abc...") EndIf EndSwitch WEnd EDIT: Forgot the code tags Edited April 20, 2010 by GEOSoft George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" Link to comment Share on other sites More sharing options...
ned98 Posted April 30, 2010 Author Share Posted April 30, 2010 Is this what you want? While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE MsgBox (0, "TEST", "Message Text.") Case $STUPIDBUTTON If GUICtrlRead($Radio1) = 1 AND GUICtrlRead($Checkbox1) = 1 Then MsgBox (0, "TEST", "TEST COMPLETED.") Then Exit Else MsgBox(0, "ERRORE", "abc...") EndIf EndSwitch WEnd EDIT: Forgot the code tags Thank you very much for the help! This code works perfectly. Link to comment Share on other sites More sharing options...
GEOSoft Posted April 30, 2010 Share Posted April 30, 2010 You're wlecome and you should read up on If/ElseIf/Else/EndIf statements in the help file. If there are more than 2 conditions then you use ElseIf (usually coupled with an Else) If $Condition_1 Then ;; Perform some functions ElseIf $Condition_2 Then ;; Perform a second set of functions ElseIf $Condition_3 ;; Perform a third set of functions Else ;; Perform yet another set of functions EndIf George Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.*** The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number. Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else. "Old age and treachery will always overcome youth and skill!" 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