Sendkey

Started by Secondlaw, January 02, 2019, 11:50:42 AM

Previous topic - Next topic

Secondlaw

One more question for today.

Is there a better option for "Sendkey".  Instead of typing text, is there a command to just put the entire txt?  For example, I have a popup box and when the popup box appears, I simply want to have the text populate the available spot.  Sendkey actually sends each part of the txt 1 character at a time. 

snowsnowsnow

Well, you can send multiple keys with a single SendKey() call - but I assume you already know that.  As you say, it is still sending each key, one at a time.

I think you are looking for the Control Manager.  That allows you to populate a box in a single action.

However, a full explanation of how to use the CM is beyond the scope of this post.

JTaylor

Another option, depends on the situation as to the viability of this but I sometimes paste text to clipboard and used SendKey() with Ctrl-v to paste so as to avoid what you describe.

Jim

td

IntControl 35 can be used to control key delay.  An even better option is to use the second optional parameter to the SendKey function to set the delay to something like 0 or .01 to remove all or almost all of the delays between individual keys.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Secondlaw

Thank You, I'll give this a try.  :)

ChuckC

Is there a reason that the Control Manager extender wouldn't be suitable for use with automating this data entry task?

td

Fewer and fewer applications use Windows Common Controls for UI widgets.  In fact, the feasibility of creating a new extender using MSFT's UI Automation interfaces is currently under consideration. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade