WinBatch® Technical Support Forum

All Things WinBatch => WinBatch => Topic started by: Secondlaw on January 02, 2019, 11:50:42 AM

Title: Sendkey
Post by: Secondlaw on January 02, 2019, 11:50:42 AM
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. 
Title: Re: Sendkey
Post by: snowsnowsnow on January 02, 2019, 12:21:22 PM
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.
Title: Re: Sendkey
Post by: JTaylor on January 02, 2019, 12:32:37 PM
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
Title: Re: Sendkey
Post by: td on January 02, 2019, 01:05:03 PM
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.
Title: Re: Sendkey
Post by: Secondlaw on January 04, 2019, 04:57:26 AM
Thank You, I'll give this a try.  :)
Title: Re: Sendkey
Post by: ChuckC on January 04, 2019, 05:16:57 AM
Is there a reason that the Control Manager extender wouldn't be suitable for use with automating this data entry task?
Title: Re: Sendkey
Post by: td on January 04, 2019, 07:57:25 AM
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.