AutoHotkey Community

It is currently May 26th, 2012, 7:05 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 5 posts ] 
Author Message
PostPosted: May 26th, 2009, 5:19 pm 
Offline

Joined: May 15th, 2009, 4:49 pm
Posts: 14
Location: Tulsa, OK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 5:35 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
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

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 6:14 pm 
Offline

Joined: May 15th, 2009, 4:49 pm
Posts: 14
Location: Tulsa, OK
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 6:26 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5480
Location: the tunnel(?=light)
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.

_________________
Image
Try Quick Search for Autohotkey or see the tutorial for newbies.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: May 26th, 2009, 6:38 pm 
Offline

Joined: May 15th, 2009, 4:49 pm
Posts: 14
Location: Tulsa, OK
AHHHHH.. That makes a lot of sense.. I think I finally understand the loop command..

THANKS!

H


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 5 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: Apollo, Bing [Bot], dra, Exabot [Bot], Google Feedfetcher, rbrtryn and 60 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group