 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
Hannibal_32
Joined: 15 May 2009 Posts: 14 Location: Tulsa, OK
|
Posted: Tue May 26, 2009 4:19 pm Post subject: Uncheck All?? Checkbox question |
|
|
Hey guys.. Have a really quick question that I was unable to solve by looking into previous posts. I have a script with 42 checkboxes.. I would like for the user to be able to undo all of the checkboxes with an "uncheck" box, rather than unchecking all of them individually. Is this possible??
Thanks,
H |
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Tue May 26, 2009 4:35 pm Post subject: |
|
|
If the ClassNN of the checkboxes are an incrementing value (Button1, Button2, etc.) you should be able to run a loop to uncheck them all:
| Code: | SetControlDelay -1
Loop, 42
GuiControl, CheckBox, Button%A_Index%, 0 ; 0 indicates unchecked checkbox |
_________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
Hannibal_32
Joined: 15 May 2009 Posts: 14 Location: Tulsa, OK
|
Posted: Tue May 26, 2009 5:14 pm Post subject: |
|
|
Hey Sink.. Unfortunately, my buttons are not sequentially named, nor can they be. Good idea for the future though.. Is there a way to shorten this?
| Code: |
ButtonUncheckAll:
GuiControl, , CB1, 0
GuiControl, , CB2, 0
GuiControl, , CB3, 0
GuiControl, , CB4, 0
GuiControl, , CB5, 0
GuiControl, , CB6, 0
GuiControl, , CB7, 0
GuiControl, , CB8, 0
GuiControl, , CB9, 0
GuiControl, , CB10, 0
GuiControl, , CB11, 0
GuiControl, , CB12, 0
GuiControl, , CB13, 0
GuiControl, , CB14, 0
GuiControl, , CB15, 0
GuiControl, , CB16, 0
GuiControl, , CB17, 0
GuiControl, , CB18, 0
GuiControl, , CB19, 0
GuiControl, , CB20, 0
GuiControl, , CB21, 0
GuiControl, , CB22, 0
GuiControl, , CB23, 0
GuiControl, , CB24, 0
GuiControl, , CB25, 0
GuiControl, , CB26, 0
GuiControl, , CB27, 0
GuiControl, , CB28, 0
GuiControl, , CB29, 0
GuiControl, , CB30, 0
GuiControl, , CB31, 0
GuiControl, , CB32, 0
GuiControl, , CB33, 0
GuiControl, , CB34, 0
GuiControl, , CB35, 0
GuiControl, , CB36, 0
GuiControl, , CB37, 0
GuiControl, , CB38, 0
GuiControl, , CB39, 0
GuiControl, , CB40, 0
GuiControl, , CB41, 0
GuiControl, , CB42, 0
return
|
|
|
| Back to top |
|
 |
sinkfaze
Joined: 18 Mar 2008 Posts: 5044 Location: the tunnel(?=light)
|
Posted: Tue May 26, 2009 5:26 pm Post subject: |
|
|
| Hannibal_32 wrote: | | Unfortunately, my buttons are not sequentially named, nor can they be. |
Oh no what I meant was when you physically open the GUI and check the ClassNN of the checkbox controls, usually they are sequential.
Theoretically you should still be able to shorten it the same way using your variables:
| Code: | ButtonUncheckAll:
SetControlDelay -1
Gui, Submit, NoHide
Loop, 42
GuiControl, CheckBox, CB%A_Index%, 0 |
If that doesn't appear to work you can always clear out the 'CheckBox' section of the GUIControl command and try again but I think that will be necessary to set the checkbox properly. _________________ Try Quick Search for Autohotkey or see the tutorial for newbies. |
|
| Back to top |
|
 |
Hannibal_32
Joined: 15 May 2009 Posts: 14 Location: Tulsa, OK
|
Posted: Tue May 26, 2009 5:38 pm Post subject: |
|
|
AHHHHH.. That makes a lot of sense.. I think I finally understand the loop command..
THANKS!
H |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|