Author Topic: Sendkey  (Read 170 times)

Secondlaw

  • Newbie
  • *
  • Posts: 27
Sendkey
« 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. 

snowsnowsnow

  • Sr. Member
  • ****
  • Posts: 253
Re: Sendkey
« Reply #1 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.

JTaylor

  • Pundit
  • *****
  • Posts: 947
    • Data & Stuff Inc.
Re: Sendkey
« Reply #2 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

td

  • Tech Support
  • *****
  • Posts: 2769
    • WinBatch
Re: Sendkey
« Reply #3 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.
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade

Secondlaw

  • Newbie
  • *
  • Posts: 27
Re: Sendkey
« Reply #4 on: January 04, 2019, 04:57:26 am »
Thank You, I'll give this a try.  :)

ChuckC

  • Full Member
  • ***
  • Posts: 173
Re: Sendkey
« Reply #5 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?

td

  • Tech Support
  • *****
  • Posts: 2769
    • WinBatch
Re: Sendkey
« Reply #6 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. 
"No one who sees a peregrine falcon fly can ever forget the beauty and thrill of that flight."
  - Dr. Tom Cade