Page 1 of 1

sendkeys syntax for a CBT

Posted: 21 Feb 2018 20:00
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?

Re: sendkeys syntax for a CBT

Posted: 21 Feb 2018 20:10
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

Re: sendkeys syntax for a CBT

Posted: 22 Feb 2018 14:24
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.

Re: sendkeys syntax for a CBT

Posted: 22 Feb 2018 14:32
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.