SteveO Posted July 1, 2008 Posted July 1, 2008 (edited) Ok, i've got this posting code, that is suppose to check the GUI. It works great for the first check, but when I update the checkboxes, specifically when I uncheck a box, it still outputs the code of the unchecked section. I have the following function set to a hotkey, so this is really the only code along with the GUI. So basically it works when I check the boxes initially, but it doesn't work when I uncheck a box. expandcollapse popupFunc Post() ;;Check the GUI $Message = GUICtrlRead($Edit1) $Random = GUICtrlRead($List1) $StartBB = GUICtrlRead($Input1) $EndBB = GUICtrlRead($Input2) $PostNumber = GUICtrlRead($Input3) $a1 = GUICtrlRead($Activate1) $a2 = GUICtrlRead($Activate2) $a3 = GUICtrlRead($Numberedbumps) ;; Output the correct option Select Case $a1 and $a2 and $a3 = $GUI_CHECKED Send($Message & "{ENTER}" & $Random &$StartBB & " " & $PostNumber & $EndBB) Case $a1 and $a2 = $GUI_CHECKED Send($Message & "{ENTER}" & $Random ) Case $a1 and $a3 = $GUI_CHECKED Send($Message & $StartBB & " " & $PostNumber & $EndBB) Case $a2 and $a3 = $GUI_CHECKED Send($Random & $StartBB & " " & $PostNumber & $EndBB) Case $a3 = $GUI_CHECKED Send($StartBB & $PostNumber & $EndBB) EndSelect ;;+1 to the post number GUICtrlSetData ($Input3, $PostNumber + 1) EndFunc Edited July 1, 2008 by SteveO
dmob Posted July 1, 2008 Posted July 1, 2008 (edited) Try using this format: CODECase BitAND($a1, $GUI_CHECKED) = $GUI_CHECKED Edited July 1, 2008 by dalisuit
SteveO Posted July 1, 2008 Author Posted July 1, 2008 Like this? Cause it didn't work. Func Post() $Message = GUICtrlRead($Edit1) $Random = GUICtrlRead($List1) $StartBB = GUICtrlRead($Input1) $EndBB = GUICtrlRead($Input2) $PostNumber = GUICtrlRead($Input3) $a1 = GUICtrlRead($Activate1) $a2 = GUICtrlRead($Activate2) $a3 = GUICtrlRead($Numberedbumps) Select Case BitAND($a1 and $a2 and $a3, $GUI_CHECKED) = $GUI_CHECKED Send($Message & "{ENTER}" & $Random &$StartBB & " " & $PostNumber & $EndBB) Case BitAND($a1 and $a2, $GUI_CHECKED) = $GUI_CHECKED Send($Message & "{ENTER}" & $Random ) Case BitAND($a1 and $a3, $GUI_CHECKED) = $GUI_CHECKED Send($Message & $StartBB & " " & $PostNumber & $EndBB) Case BitAND($a2 and $a3, $GUI_CHECKED) = $GUI_CHECKED Send($Random & $StartBB & " " & $PostNumber & $EndBB) Case BitAND($a3, $GUI_CHECKED) = $GUI_CHECKED Send($StartBB & $PostNumber & $EndBB) Case BitAND($a1, $GUI_CHECKED) = $GUI_CHECKED Send($StartBB & $PostNumber & $EndBB) EndSelect GUICtrlSetData ($Input3, $PostNumber + 1) EndFunc
PsaltyDS Posted July 1, 2008 Posted July 1, 2008 Please explain in plain language what you meant by this line. I suspect you misunderstand what "AND" is doing in a boolean context: Case $a1 and $a2 and $a3 = $GUI_CHECKED Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
SteveO Posted July 1, 2008 Author Posted July 1, 2008 Please explain in plain language what you meant by this line. I suspect you misunderstand what "AND" is doing in a boolean context: Case $a1 and $a2 and $a3 = $GUI_CHECKED Haha, if a1 and a2 and a3 are checked do the following.
PsaltyDS Posted July 1, 2008 Posted July 1, 2008 Haha, if a1 and a2 and a3 are checked do the following. I was afraid of that. What you are getting is: "If ($a1 = True) AND ($a2 = True) AND ($a3 = True) AND ($GUI_CHECKED = True) Then" Try this instead: If BitAND($a1, $a2, $3, $GUI_CHECKED) Then Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
SteveO Posted July 1, 2008 Author Posted July 1, 2008 Ok, so it works to a point. The problem being since it goes down and checks the other statements, it'll output more than once for each true statement. If BitAND($a1, $a2, $a3, $GUI_CHECKED) Then Send($Message & "{ENTER}" & $Random &$StartBB & " " & $PostNumber & $EndBB) Endif If BitAND($a1, $a2, $GUI_CHECKED) Then Send($Message & "{ENTER}" & $Random ) Endif If BitAND($a1, $a3, $GUI_CHECKED) Then Send($Message & $StartBB & " " & $PostNumber & $EndBB) EndIf If BitAND($a2, $a3, $GUI_CHECKED) Then Send($Random & $StartBB & " " & $PostNumber & $EndBB) EndIf If BitAND($a3, $GUI_CHECKED) Then Send($StartBB & $PostNumber & $EndBB) EndIf If BitAND($a1, $GUI_CHECKED) Then Send($StartBB & $PostNumber & $EndBB) EndIf
AdmiralAlkex Posted July 1, 2008 Posted July 1, 2008 You should use IfElse instead of multiple if's, see helpfile for examples and tell us if there is any problems! .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
aslani Posted July 1, 2008 Posted July 1, 2008 Try this; Select Case BitAND($a1, $a2, $a3, $GUI_CHECKED) Send($Message & "{ENTER}" & $Random &$StartBB & " " & $PostNumber & $EndBB) Case BitAND($a1, $a2, $GUI_CHECKED) Send($Message & "{ENTER}" & $Random ) Case BitAND($a1, $a3, $GUI_CHECKED) Send($Message & $StartBB & " " & $PostNumber & $EndBB) Case BitAND($a2, $a3, $GUI_CHECKED) Send($Random & $StartBB & " " & $PostNumber & $EndBB) Case BitAND($a3, $GUI_CHECKED) Send($StartBB & $PostNumber & $EndBB) Case BitAND($a1, $GUI_CHECKED) Send($StartBB & $PostNumber & $EndBB) EndSelect [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
PsaltyDS Posted July 1, 2008 Posted July 1, 2008 Ok, so it works to a point. The problem being since it goes down and checks the other statements, it'll output more than once for each true statement. If BitAND($a1, $a2, $a3, $GUI_CHECKED) Then Send($Message & "{ENTER}" & $Random &$StartBB & " " & $PostNumber & $EndBB) Endif If BitAND($a1, $a2, $GUI_CHECKED) Then Send($Message & "{ENTER}" & $Random ) Endif If BitAND($a1, $a3, $GUI_CHECKED) Then Send($Message & $StartBB & " " & $PostNumber & $EndBB) EndIf If BitAND($a2, $a3, $GUI_CHECKED) Then Send($Random & $StartBB & " " & $PostNumber & $EndBB) EndIf If BitAND($a3, $GUI_CHECKED) Then Send($StartBB & $PostNumber & $EndBB) EndIf If BitAND($a1, $GUI_CHECKED) Then Send($StartBB & $PostNumber & $EndBB) EndIf Then it did exactly what you told it to do in the code above. What did you mean for it to do, in plain language? Valuater's AutoIt 1-2-3, Class... Is now in Session!For those who want somebody to write the script for them: RentACoder"Any technology distinguishable from magic is insufficiently advanced." -- Geek's corollary to Clarke's law
aslani Posted July 1, 2008 Posted July 1, 2008 (edited) Then it did exactly what you told it to do in the code above. What did you mean for it to do, in plain language? From what I understand he wants it to do the following;Only If a1, a2 and a3 are checked, then send message1Only If a1 and a2 are checked, but not a3, then send message2Only If a1 and a3 are checked, but not a2, send message3...etcThat's why I offered a Select...Case...EndSelect option rather than a long If...ElseIf...Else....EndIf statement. Edited July 1, 2008 by aslani [font="Georgia"]Chances are, I'm wrong.[/font]HotKey trouble?Stringregexp GuideAutoIT Current Version
SteveO Posted July 1, 2008 Author Posted July 1, 2008 Try this; Select Case BitAND($a1, $a2, $a3, $GUI_CHECKED) Send($Message & "{ENTER}" & $Random &$StartBB & " " & $PostNumber & $EndBB) Case BitAND($a1, $a2, $GUI_CHECKED) Send($Message & "{ENTER}" & $Random ) Case BitAND($a1, $a3, $GUI_CHECKED) Send($Message & $StartBB & " " & $PostNumber & $EndBB) Case BitAND($a2, $a3, $GUI_CHECKED) Send($Random & $StartBB & " " & $PostNumber & $EndBB) Case BitAND($a3, $GUI_CHECKED) Send($StartBB & $PostNumber & $EndBB) Case BitAND($a1, $GUI_CHECKED) Send($StartBB & $PostNumber & $EndBB) EndSelect Perfect. Thanks everyone for your input on this issue. =)
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