Accesing check boxes and clicking buttons

Accesing check boxes and clicking buttons

Post by ern » Sun, 19 Mar 2006 01:42:56

I have a .exe file which searches for a device then opens up a window.
The window has a check box and [Start] [Cancel] button options. I
want to check the box and press start when the window appears.

1. How do I know when the window appears ?

2. And more importantly how can I access the check box and start
button programmatically ?

All I have is the .exe (not the source). I could use Java's Robot
mechanism if I could get past #1, but I'd much prefer #2 over Java


Accesing check boxes and clicking buttons

Post by mr_unrelia » Sun, 19 Mar 2006 08:17:38

hi erm,

With vbs, one can use the "AppActivate" method to determine when a
window appears. While this may at first appear counter-intuitive,
(how can you appactivate something that isn't there) it does work.

You use AppActivate as a function. It will return false if the
window has not appeared as yet, and true when the window does

The usual strategy is to go into a loop, using appactivate to
test for the appearance of the window. (Its also a good idea
to put a sleep in the loop to allow the app to load).

As for part 2, that is a little more tricky. Most (er, um,
"well-programmed" apps) have "speed-keys" for their controls.
In other words, you may be able to click the "cancel" button
by sending an "alt-c" keystroke. Otherwise you may have to
send tab characters to give the focus to the control you want
and then a cr to implement (i.e., check a checkbox, or click
a button)

cheers, jw

You got questions? WE GOT ANSWERS!!! ..(but,
no guarantee the answers will be applicable to the questions)