EliTe_ThuT Posted February 5, 2007 Share Posted February 5, 2007 (edited) [GUI] Hi, in my script I want that when I click on a button, it checks if one or more of the three check boxes are checked. If it's checked, I writes information in an Ini file, if not, well it doesn't do anything. But I'm not able to make an If ... then ... that checks for the three if...then... It only works for the first if ... then... Not the 2 others...here's my code. Case $msg = $Button_1 ;Update Info $Checkbox1 = GUICtrlRead($Checkbox_1) $Checkbox2 = GUICtrlRead($Checkbox_2) $Checkbox3 = GUICtrlRead($Checkbox_3) $Input1 = GUICtrlRead($Input_1) $Input3 = GUICtrlRead($Input_3) $Input2 = GUICtrlRead($Input_2) ;Check for the "Remember" if $Checkbox1 = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input1", $Input1) if $Checkbox2 = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input2", $Input2) if $Checkbox2 = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input3", $Input3) Someone can help me with that plz? EDIT: Sorry, I just realized this is supposed to be in the General Help and Support (GUI)...you can move my topic. Still need help though Edited February 5, 2007 by EliTe_ThuT Link to comment Share on other sites More sharing options...
enaiman Posted February 5, 2007 Share Posted February 5, 2007 ;Check for the "Remember" if GuiCtrlRead($Checkbox1) = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input1", $Input1) endif if GuiCtrlRead($Checkbox2) = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input2", $Input2) endif if GuiCtrlRead($Checkbox3) = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input3", $Input3) endif You need to put an "EndIf" after every "If" used. I don't know why the script allowed execution but this should work. SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) Link to comment Share on other sites More sharing options...
xcal Posted February 5, 2007 Share Posted February 5, 2007 (edited) "If condition then function()" doesn't require an EndIf. Edit - To answer the question, I think what you want to be doing is... If condition Then ... ElseIf condition Then ... ElseIf condition Then ... EndIf ...but I don't think i quite understood the question. Edited February 5, 2007 by xcal How To Ask Questions The Smart Way Link to comment Share on other sites More sharing options...
EliTe_ThuT Posted February 5, 2007 Author Share Posted February 5, 2007 You need to put an "EndIf" after every "If" used. I don't know why the script allowed execution but this should work. Actually, I just found my mistake...and this is not my mistake. When you put If ... Then ... on one line, you don't need EndIf. My problem was pretty simple. if $Checkbox1 = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input1", $Input1) if $Checkbox2 = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input2", $Input2) if $Checkbox2 = $GUI_CHECKED then IniWrite("JTR.ini","Remember","Input3", $Input3) I have if $Checkbox2 two times...that's why Checkbox 3 wasn't working...lol Link to comment Share on other sites More sharing options...
enaiman Posted February 5, 2007 Share Posted February 5, 2007 "If condition then function()" doesn't require an EndIf.Thanks for the tip I'm an "old school" boy and I prefer to do it properly each time.Indeed the code is more complicated but at least I don't make mistakes.But ... everyone has a style SNMP_UDF ... for SNMPv1 and v2c so far, GetBulk and a new example script wannabe "Unbeatable" Tic-Tac-Toe Paper-Scissor-Rock ... try to beat it anyway :) 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