WinBatch Tech Support Home

Database Search

If you can't find the information using the categories below, post a question over in our WinBatch Tech Support Forum.

TechHome

Sending Keystrokes

Can't find the information you are looking for here? Then leave a message over on our WinBatch Tech Support Forum.

How to Check a Checkbox by Default

Keywords:   checkbox 

Question:

How do I have a checkbox unchecked by default? Do I need to check the status first?

Answer:

If you do type ALT-underlined-character does the checkbox hilight?

If you type a minus sign does it clear. If you type a - sign, does that uncheck it, and if you type + sign does that check it?

If you need it unchecked, you don't really need to know the state is in. Rather, you can make sure you set it to unchecked.

On *most* checkboxes, changing the focus to it and then typing a minus sign will clear the checkbox no matter what its state is.

Let's say your checkbox name has an underline character like C (in which case the hotkey ALT-C can take you to the checkbox).

;To toggle the checkbox
SendKey("!c")

;To Always check the box
SendKey("!c{+}")  ; note the curly braces around the plus sign

;To Always clear the box
SendKey("!c-")	
Note that sending the box a + will always set it and a - will always clear it. A space will toggle it. These are very badly documented keystrokes that Windows actually recognize.

Note: Some applications require that you send the plus (+) or minus (-) key from the numeric portion of your keyboard. To send those keys:

+ on numeric keypad      {NUMPAD+}
- on numeric keypad      {NUMPAD-}
Use:
Sendkeysto("yourwindowname", "{NUMPAD+}")
and/or:
Sendkeysto("yourwindowname", "{NUMPAD-}")

Article ID:   W13199
Filename:   Check a Checkbox by Default.txt
File Created: 2011:09:16:12:12:02
Last Updated: 2011:09:16:12:12:02