Queener Posted July 7, 2015 Share Posted July 7, 2015 i know it has been discussed many times, but have not mention a work around. Was wondering is it possible to nested an if statement that if all statements are true then do... The only thing I would go about is find the false statement then do... But what if the statement is false then only the first if statement would execute. This also applies to Case statement. Another way is to create a new function one right after another if it's true, but with all of these, it's too much hassle and coding.if guictrlread($checkbox1) = $gui_checked then do... endif if guictrlread($checkbox2) = $gui_checked then do... endif if guictrlread($checkbox3) = $gui_checked then do... endif Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") Link to comment Share on other sites More sharing options...
jdelaney Posted July 7, 2015 Share Posted July 7, 2015 (edited) I'm not following...but if you check all are true first, then if that's not the case, check the individual checks:If guictrlread($checkbox1) = $gui_checked And guictrlread($checkbox2) = $gui_checked And guictrlread($checkbox3) = $gui_checked Then Do Until False ElseIf Not guictrlread($checkbox1) = $gui_checked Then ElseIf Not guictrlread($checkbox2) = $gui_checked Then ElseIf Not guictrlread($checkbox3) = $gui_checked Then EndIfor I guess you can cover every permutationLocal $checkbox1, $checkbox2, $checkbox3 If guictrlread($checkbox1) = $gui_checked And guictrlread($checkbox2) = $gui_checked And guictrlread($checkbox3) = $gui_checked Then ElseIf guictrlread($checkbox1) = $gui_checked And guictrlread($checkbox2) = $gui_checked Then ElseIf guictrlread($checkbox2) = $gui_checked And guictrlread($checkbox3) = $gui_checked Then ElseIf guictrlread($checkbox1) = $gui_checked And guictrlread($checkbox3) = $gui_checked Then ElseIf guictrlread($checkbox1) = $gui_checked Then ElseIf guictrlread($checkbox2) = $gui_checked Then ElseIf guictrlread($checkbox3) = $gui_checked Then EndIfsimplified$1 = (guictrlread($checkbox1) = $gui_checked) $2 = (guictrlread($checkbox2) = $gui_checked) $3 = (guictrlread($checkbox3) = $gui_checked) If $1 And $2 And $3 Then ElseIf $1 And $2 Then ElseIf $2 And $3 Then ElseIf $1 And $3 Then ElseIf $1 Then ElseIf $2 Then ElseIf $3 Then Else ConsoleWrite("All False" & @CRLF) EndIf; same as Select Case $1 And $2 And $3 Case $1 And $2 Case $2 And $3 Case $1 And $3 Case $1 Case $2 Case $3 Case Else EndSelect Edited July 7, 2015 by jdelaney Queener 1 IEbyXPATH-Grab IE DOM objects by XPATH IEscriptRecord-Makings of an IE script recorder ExcelFromXML-Create Excel docs without excel installed GetAllWindowControls-Output all control data on a given window. Link to comment Share on other sites More sharing options...
Queener Posted July 7, 2015 Author Share Posted July 7, 2015 First example is exactly what I'm looking for... Msgbox(0, "Hate", "Just hate it when I post a question and find my own answer after a couple tries. But if I don't post the question, I can't seem to resolve it at all.") 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