cleiton12 Posted June 4, 2011 Share Posted June 4, 2011 (edited) I have a script with many check boxes and want to create a check box to select all groups so that the code does not know who put it there would know me grateful Edited June 4, 2011 by cleiton12 Link to comment Share on other sites More sharing options...
ahmet Posted June 4, 2011 Share Posted June 4, 2011 Maybe thisGUICreate("test") Global $num_of_checkboxes=10 Global $checkboxes[$num_of_checkboxes+1] For $i=1 To $num_of_checkboxes $checkboxes[$i]=GUICtrlCreateCheckbox("Checkbox " & $i,10,$i*25) Next $select_all=GUICtrlCreateButton("Select all",150,300) GUISetState() While 1 Switch GUIGetMsg() Case -3 ExitLoop Case $select_all For $i=$checkboxes[1] To $checkboxes[$num_of_checkboxes] GUICtrlSetState($i,1) Next EndSwitch WEnd. Next time be more clearer and put show some code Link to comment Share on other sites More sharing options...
cleiton12 Posted June 4, 2011 Author Share Posted June 4, 2011 Testing Link to comment Share on other sites More sharing options...
cleiton12 Posted June 4, 2011 Author Share Posted June 4, 2011 and so I want more I want in groups so #include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #Region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 217, 294, 228, 172) $Group1 = GUICtrlCreateGroup("Group1", 8, 8, 97, 185) $Checkbox2 = GUICtrlCreateCheckbox("Checkbox2", 16, 48, 97, 17) $Checkbox3 = GUICtrlCreateCheckbox("Checkbox3", 16, 72, 97, 17) $Checkbox4 = GUICtrlCreateCheckbox("Checkbox4", 16, 96, 97, 17) $Checkbox5 = GUICtrlCreateCheckbox("Checkbox5", 16, 120, 97, 17) $Checkbox6 = GUICtrlCreateCheckbox("Checkbox6", 16, 144, 97, 17) $Checkbox1 = GUICtrlCreateCheckbox("Checkbox1", 16, 24, 97, 17) $Checkbox7 = GUICtrlCreateCheckbox("Checkbox7", 16, 168, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Group2", 112, 8, 97, 185) $Checkbox8 = GUICtrlCreateCheckbox("Checkbox8", 120, 24, 97, 17) $Checkbox9 = GUICtrlCreateCheckbox("Checkbox9", 120, 48, 97, 17) $Checkbox10 = GUICtrlCreateCheckbox("Checkbox10", 120, 72, 97, 17) $Checkbox11 = GUICtrlCreateCheckbox("Checkbox11", 120, 96, 97, 17) $Checkbox12 = GUICtrlCreateCheckbox("Checkbox12", 120, 120, 97, 17) $Checkbox13 = GUICtrlCreateCheckbox("Checkbox13", 120, 144, 97, 17) $Checkbox14 = GUICtrlCreateCheckbox("Checkbox14", 120, 168, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Group3", 8, 200, 201, 89) $SelectallGroup1 = GUICtrlCreateCheckbox("Select all Group1", 16, 216, 105, 17) $SelectallGroup2 = GUICtrlCreateCheckbox("Select all Group2", 16, 232, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #EndRegion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit EndSwitch WEnd Link to comment Share on other sites More sharing options...
martin Posted June 4, 2011 Share Posted June 4, 2011 Not sure if I understand but maybe this or similar. expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 217, 294, 228, 172) $Group1 = GUICtrlCreateGroup("Group1", 8, 8, 97, 185) $CheckGrpA1 = GUICtrlCreateCheckbox("Checkbox2", 16, 48, 97, 17) $CheckGrpA2 = GUICtrlCreateCheckbox("Checkbox3", 16, 72, 97, 17) $CheckGrpA3 = GUICtrlCreateCheckbox("Checkbox4", 16, 96, 97, 17) $CheckGrpA4 = GUICtrlCreateCheckbox("Checkbox5", 16, 120, 97, 17) $CheckGrpA5 = GUICtrlCreateCheckbox("Checkbox6", 16, 144, 97, 17) $CheckGrpA6 = GUICtrlCreateCheckbox("Checkbox1", 16, 24, 97, 17) $CheckGrpA7 = GUICtrlCreateCheckbox("Checkbox7", 16, 168, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Group2", 112, 8, 97, 185) $CheckGrpB1 = GUICtrlCreateCheckbox("Checkbox8", 120, 24, 97, 17) $CheckGrpB2 = GUICtrlCreateCheckbox("Checkbox9", 120, 48, 97, 17) $CheckGrpB3 = GUICtrlCreateCheckbox("Checkbox10", 120, 72, 97, 17) $CheckGrpB4 = GUICtrlCreateCheckbox("Checkbox11", 120, 96, 97, 17) $CheckGrpB5 = GUICtrlCreateCheckbox("Checkbox12", 120, 120, 97, 17) $CheckGrpB6 = GUICtrlCreateCheckbox("Checkbox13", 120, 144, 97, 17) $CheckGrpB7 = GUICtrlCreateCheckbox("Checkbox14", 120, 168, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Group3", 8, 200, 201, 89) $SelectallGroup1 = GUICtrlCreateCheckbox("Select all Group1", 16, 216, 105, 17) $SelectallGroup2 = GUICtrlCreateCheckbox("Select all Group2", 16, 232, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SelectallGroup1 _Flip($nMsg, "CheckGrpA") Case $SelectallGroup2 _Flip($nMsg,"CheckGrpB") EndSwitch WEnd func _Flip($chkid, $sGrp) Local $state If BitAND(GUICtrlRead($chkid), $GUI_CHECKED) Then $state = $GUI_CHECKED Else $state = $GUI_UNCHECKED EndIf $n = 1 While 1 $id = Eval($sGrp & $n) If $id = 0 Then ExitLoop GUICtrlSetState($id, $state) $n += 1 WEnd EndFunc Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
cleiton12 Posted June 4, 2011 Author Share Posted June 4, 2011 yes that and what I was looking for thank you thank you even serious Link to comment Share on other sites More sharing options...
cleiton12 Posted June 5, 2011 Author Share Posted June 5, 2011 sorry I have the script and has many names and I really wanted and a check box that selects groups because what you send me one that was selected by name type A and B by group I wanted Link to comment Share on other sites More sharing options...
martin Posted June 5, 2011 Share Posted June 5, 2011 sorry I have the script and has many names and I really wanted and a check box that selects groups because what you send me one that was selected by name type A and B by group I wanted Well this approach will work for any names for the check boxes but you must use the correct names for the group boxes and the checkboxes which select a complete group expandcollapse popup#include <ButtonConstants.au3> #include <GUIConstantsEx.au3> #include <WindowsConstants.au3> #include <winapi.au3> #region ### START Koda GUI section ### Form= $Form2 = GUICreate("Form2", 217, 294, 228, 172) $Group1 = GUICtrlCreateGroup("Group1", 8, 8, 97, 185) $CheckGrpA1 = GUICtrlCreateCheckbox("Checkbox2", 16, 48, 97, 17) $Checkrandomxht5 = GUICtrlCreateCheckbox("Checkbox3", 16, 72, 97, 17) $CheckGyyyyyA3 = GUICtrlCreateCheckbox("Checkbox4", 16, 96, 97, 17) $CheckGrpA4 = GUICtrlCreateCheckbox("Checkbox5", 16, 120, 97, 17) $CheckGrpA5 = GUICtrlCreateCheckbox("Checkbox6", 16, 144, 97, 17) $CheckGrkjhkhkhpA6 = GUICtrlCreateCheckbox("Checkbox1", 16, 24, 97, 17) $CheckGrpA7 = GUICtrlCreateCheckbox("Checkbox7", 16, 168, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group2 = GUICtrlCreateGroup("Group2", 112, 8, 97, 185) $CheckGrpxxxB1 = GUICtrlCreateCheckbox("Checkbox8", 120, 24, 97, 17) $CheckGrpB2 = GUICtrlCreateCheckbox("Checkbox9", 120, 48, 97, 17) $CheckG7erfherdfu7rpB3 = GUICtrlCreateCheckbox("Checkbox10", 120, 72, 97, 17) $CheckGrpB4 = GUICtrlCreateCheckbox("Checkbox11", 120, 96, 97, 17) $CheckGrpB5 = GUICtrlCreateCheckbox("Checkbox12", 120, 120, 97, 17) $CheckG2322rpB6 = GUICtrlCreateCheckbox("Checkbox13", 120, 144, 97, 17) $CheckGrpvbnffB7 = GUICtrlCreateCheckbox("Checkbox14", 120, 168, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) $Group3 = GUICtrlCreateGroup("Group3", 8, 200, 201, 89) $SelectallGroup1 = GUICtrlCreateCheckbox("Select all Group1", 16, 216, 105, 17) $SelectallGroup2 = GUICtrlCreateCheckbox("Select all Group2", 16, 232, 97, 17) GUICtrlCreateGroup("", -99, -99, 1, 1) GUISetState(@SW_SHOW) #endregion ### END Koda GUI section ### $g = ControlGetPos($Form2, "", $SelectallGroup1) ConsoleWrite($g[0] & ', ' & $g[1] & ', ' & $g[2] & ', ' & $g[3] & @CRLF) $bc = _CountButtons($Form2) ConsoleWrite($bc & @CRLF) While 1 $nMsg = GUIGetMsg() Switch $nMsg Case $GUI_EVENT_CLOSE Exit Case $SelectallGroup1 _Flip($nMsg, $Group1) Case $SelectallGroup2 _Flip($nMsg, $Group2) EndSwitch WEnd Func _Flip($chkid, $sGrp) Local $state, $n, $pos, $hb, $id Local $g = ControlGetPos($Form2, "", $sGrp) If BitAND(GUICtrlRead($chkid), $GUI_CHECKED) Then $state = $GUI_CHECKED Else $state = $GUI_UNCHECKED EndIf For $n = 1 To $bc $pos = ControlGetPos($Form2, "", "[CLASSNN:Button" & $n & "]") If _isInside($pos, $g) Then $hb = ControlGetHandle($Form2, "", "Button" & $n) $id = _WinAPI_GetDlgCtrlID($hb) GUICtrlSetState($id, $state) EndIf Next EndFunc ;==>_Flip Func _isInside($xy, $container) If $xy[0] < $container[0] Or $xy[0] > $container[0] + $container[2] Then Return False If $xy[1] < $container[1] Or $xy[1] > $container[1] + $container[3] Then Return False Return True EndFunc ;==>_isInside Func _CountButtons($sTitle) Local $aList = StringSplit(WinGetClassList($sTitle), @LF) Local $res = 0 For $i = 1 To UBound($aList) - 1 If $aList[$i] = "Button" Then $res += 1 Next Return $res EndFunc ;==>_CountButtons Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
cleiton12 Posted June 5, 2011 Author Share Posted June 5, 2011 error look Func _Flip($chkid, $sGrp) error: "Func" statement has no matching "EndFunc" Link to comment Share on other sites More sharing options...
Maffe811 Posted June 5, 2011 Share Posted June 5, 2011 errorlookFunc _Flip($chkid, $sGrp)error: "Func" statement has no matching "EndFunc"You do understand how to fix that, right ? [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
cleiton12 Posted June 5, 2011 Author Share Posted June 5, 2011 yes i don't understand how to fix that Link to comment Share on other sites More sharing options...
cleiton12 Posted June 5, 2011 Author Share Posted June 5, 2011 (edited) this is the program I want to create a select all the groupsTEst Edited June 5, 2011 by cleiton12 Link to comment Share on other sites More sharing options...
martin Posted June 5, 2011 Share Posted June 5, 2011 this is the program I want to create a select all the groupsI tested the code before I posted it.If I run the code I posted by copying it from my post it works. If you get an error say that there is a missing "EndFunc" there is a missing "EndFunc" and maybe you didn't copy all the code. I assume that you are new to programming and that you haven't used functions before. A neat description of what functions are is here.In AutoIt every function beginsFunc FunctionNameand endsEndFuncYou simply have the endfunc missing as the error says, but if you didn't copy that you also missed a bit more of the code I posted so copy it again. Serial port communications UDF Includes functions for binary transmission and reception.printing UDF Useful for graphs, forms, labels, reports etc.Add User Call Tips to SciTE for functions in UDFs not included with AutoIt and for your own scripts.Functions with parameters in OnEvent mode and for Hot Keys One function replaces GuiSetOnEvent, GuiCtrlSetOnEvent and HotKeySet.UDF IsConnected2 for notification of status of connected state of many urls or IPs, without slowing the script. Link to comment Share on other sites More sharing options...
Maffe811 Posted June 5, 2011 Share Posted June 5, 2011 If I run the code I posted by copying it from my post it works. Works for me too! [font="helvetica, arial, sans-serif"]Hobby graphics artist, using gimp.Automating pc stuff, using AutoIt.Listening to music, using Grooveshark.[/font]Scripts:[spoiler]Simple ScreenshotSaves you alot of trouble when taking a screenshot!Don't remember what happened with this, but aperantly the exe is all i got.If you don't want to run it, simply don't._IsRun UDFIt figures out if the script has ben ran before based on the info in a ini file.If you don't want to use exactly what i wrote, you can use it as inspiration.[/spoiler] Link to comment Share on other sites More sharing options...
cleiton12 Posted June 5, 2011 Author Share Posted June 5, 2011 yes I'm very new to autoit and thank you very much because I'm learning here with you guys Thank yourself and I am already working on the problem and already understood the problem haha I'm Brazilian and not understand very much English and difficult the guys that reason they feel this Link to comment Share on other sites More sharing options...
cleiton12 Posted June 6, 2011 Author Share Posted June 6, 2011 (edited) Tyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyyy Man's you are a super HElper very gooood Edited June 6, 2011 by cleiton12 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