Sendkey Command Has Trouble Working in a Dialog Box

Sendkey Command Has Trouble Working in a Dialog Box

Anonymous
Not applicable
3,263 Views
22 Replies
Message 1 of 23

Sendkey Command Has Trouble Working in a Dialog Box

Anonymous
Not applicable
I am trying to trigger a series of about 10 sendkeys statements which I am trying to run from VBA.

What I notice with said sendkeys series of statements is it seems to be able to execute the first sendkeys call as I intended it, i.e. pop out a dialog box but then the -- 2nd to the 10th sendkeys call all end up on the command line instead of going to the dialog box (popped out by my first sendkeys statement) of which I intended all the those sendkeys statements to go.

The command buttons are not triggerable from the command line of AutoCAD -- so I really have no choice but to try to manipulate those command buttons using sendkeys.

Please help me with any idea you have in mind.

Gratefully,
Matt
0 Likes
3,264 Views
22 Replies
Replies (22)
Message 21 of 23

Anonymous
Not applicable
Your problem is that your SendKeys statements are not sent until the procedure ends at which time they are all sent at once. You can get around this by using a timer callback function to delay the second call to SendKeys. You should be aware that any use of SendKeys is like trying to use the keyboard blindfolded while another person is sitting in front of it, you're at the mercy of both the system and the user.
0 Likes
Message 22 of 23

Anonymous
Not applicable
Thank you for your reply,

This timer callback function sounds like a really interesting concept I need to explore -- I will keep that and Laurie's mouse driving suggestion in my experiment todo list.

I will keep in mind the warning that you mentioned about the blindfolded stuff and proceed with caution.

Matt
0 Likes
Message 23 of 23

Anonymous
Not applicable
i am having the same problem. the VB or VBA stops once the AutoCad dcl is up. i cant do anything in VB until i cancel or ok the dialog manually. then i get my SendKeys "~" once the dialog is gone. any help would greatly be appreciated.
0 Likes