AutoHotkey Community

It is currently May 24th, 2012, 1:49 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 7 posts ] 
Author Message
 Post subject: help checkbox
PostPosted: July 1st, 2009, 8:27 pm 
I want to be able to have a checkbox and if it is checked then a different code will happen
i tried
IfCheckbox 1
ExitApp

just to test and im getting errors?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 8:43 pm 
Offline

Joined: December 24th, 2008, 3:25 am
Posts: 1401
Location: :noitacoL
Is that the entirety of your code? or do you have more than that?

ExitApp kills the ahk script, so checking a box would kill the command rather than run something.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 8:49 pm 
yes i understand that and this is just part of it, im just asked how would i do a if check box is checked command?


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 10:06 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5459
Location: the tunnel(?=light)
Where is the checkbox checked? In an Autohotkey GUI, in an external application, in a webpage? They're all different and require different methods to check them.

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 10:18 pm 
in a autohotkey gui sorry for not specifying before


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 10:27 pm 
Offline
User avatar

Joined: March 19th, 2008, 12:43 am
Posts: 5459
Location: the tunnel(?=light)
If you have a variable assigned to the checkbox in your script you should be able to check its value; 1 if it's checked, 0 if not.

Code:
Gui, Add, Checkbox, vVar gStatus, Is checked?
. . .
Status:
if Var ; if var is not empty or zero
  << action to take if checked >>
else
  << action to take if not checked >>
return

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: July 1st, 2009, 10:35 pm 
thanks a lot!


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

All times are UTC [ DST ]


Who is online

Users browsing this forum: BrandonHotkey, fragman, Google Feedfetcher, hd0202, jyloup, tantalus00 and 18 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