sendkeys syntax for a CBT

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
Post Reply
aurumdigitus
Posts: 1075
Joined: 30 May 2008 21:02
Location: Lake Erie

sendkeys syntax for a CBT

Post by aurumdigitus »

Want to create a toolbar button to press and hold Shift but can't make it work. Have tried the obvious sendkeys "{SHIFT}"; without success. Can any coder out there help?

jupe
Posts: 3478
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: sendkeys syntax for a CBT

Post by jupe »

Others may have alternative methods for you, but one suggestion I thought of is using an external command line tool NirCmd, I always have this on my computer because I use it all the time for various things and it should work in this situation, something like this:

Code: Select all

run "nircmd.exe sendkey shift down";
Be sure to create an opposing way to release the shift button too, or add down to left click & up to right click CTB actions, or something similar.

Code: Select all

run "nircmd.exe sendkey shift up";
For more info:
http://nircmd.nirsoft.net/sendkey.html

aurumdigitus
Posts: 1075
Joined: 30 May 2008 21:02
Location: Lake Erie

Re: sendkeys syntax for a CBT

Post by aurumdigitus »

Will have to think this over before trying. Have heard some bad things about Nirsoft utilities.

Does this work on your system?

In any case thank you for your reply.

jupe
Posts: 3478
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: sendkeys syntax for a CBT

Post by jupe »

It does exactly what you wanted, I tested it, although I can't understand a situation where you would want the Shift key held down for an extended amount of time.

I have been using Nirsoft utilities for at least a decade and thoroughly recommend them, I have never heard anything bad about them during that time either, and have only had positive experiences. It is IMO an immensely powerful utility for its 120kb size, but it is entirely up to you.

Post Reply