DonationCoder.com forum
 
Read-only archive. This is a static copy of the DonationCoder.com forum. Reading and searching work as before; logging in, posting and private messages do not.
Archive of 2026-10-21 · About this archive · Main site

Author Topic: Can't get Sendkeys to work  (Read 7,406 times)

kimbriki

  • Participant
  • Joined in 2016
  • *
  • Posts: 9
Can't get Sendkeys to work
« on: September 21, 2018, 05:11 AM »
Hi,
I have a program that has a few hotkeys that I am wanting Launchbar Commander to initiate, however, I can't get them to work.
For example, one hotkey is CTL SHIFT B, when I put the sendkey into LBC, as '^+b' (without quotes) a 'B' comes out, not the result of the hotkey, or if I try '+^b' still only the 'b'
What could I be doing wrong? (I am not using the numpad for this)

IainB

  • @Slartibartfarst
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
Re: Can't get Sendkeys to work
« Reply #1 on: September 21, 2018, 08:15 AM »
@kimbriki: Presumably, you want CTL+SHIFT+B to be sent to simulate a single simultaneous hotkey depression, right?
I am not familiar with using sendkey in LBC, but from the Help file it seems that keys are sent sequentially, which, if true, could explain why you see the output as "b" in both the cases you give above.

kimbriki

  • Participant
  • Joined in 2016
  • *
  • Posts: 9
Re: Can't get Sendkeys to work
« Reply #2 on: September 21, 2018, 09:45 AM »
Yes, I do want CTL+SHIFT+B, and as you say, this is not happening as a simultaneous key press, but appears to be sequential - how do I get the keys sent simultaneously?

mouser

  • First Author
  • Administrator
  • Joined in 2005
  • *****
  • Posts: 40,931
    • Gathering Badge
    • Plugin Coding Medal
    • Participated in NANY Challenge Seventeen Times
    • Cody Award
    • Coding Snacks
    • Volunteers/Staff
Re: Can't get Sendkeys to work
« Reply #3 on: September 22, 2018, 02:48 AM »
maybe try ^(+(b))

IainB

  • @Slartibartfarst
  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
Re: Can't get Sendkeys to work
« Reply #4 on: September 22, 2018, 06:53 AM »
@mouser:
maybe try ^(+(b))
Ahh. The penny just dropped.
Thanks for that. It helps solve a bit of a puzzle for me. I had been meaning to go back and read the rest of the LBC Help file about this, as it had been niggling away at the back of my mind. I mean, if I had been wanting to do the same thing as @kimbriki seemed to be wanting to do, then how might I go about it? I didn't actually want to do it and couldn't immediately see "why" (i.e., the user requirement) for his wanting to do it, as I thought that, if it was me, then I would usually use AHK (AutoHotkey) to do send a text string or hotkey and did not see that LBC was necessarily the "right" tool for that job. However, after reading the rest of that page of the Help file, I think I see that LBC may have other potential uses extending beyond the obvious and that I had not considered - e.g. (say), it could be used to invoke AHK functions - effectively as subroutines - opening the way to the possibility of providing a higher level of automation (which I am usually all in favour of).
This had been a minor puzzle for me  - one that I had been idly wondering about in the first place, in my exploratory use of LBC.
I looked in the Help file for something that seemed relevant to what you had written (above). This was the bit that caused me to think:
(Text partially copied below, with my emphasis.)
Quote
Sendkeys Documentation
...
Special strings that you can use in a {sendkeys} clip, from the TPushKeys help file:

Function key definitions are enclosed within braces, keys from F1 to F24 are represented by:
{F1}...{F24}

State Modifiers
Shift Key                +
Ctrl Key                        ^
Left Alt Key                %
Right Alt Key (Alt Gr)        !

Prefix any key definition with the appropriate modifier to affect the key press immediately following it e.g. +ab will result in the key strokes Ab being directed to the application.

To extend the modifier to affect a group of characters enclose them in parentheses e.g  !(ab) will result in AB being simulated. Parentheses may be nested so that !(+(ao)) will give ÁÓ.

Note: State Modifiers need not be used with standard keys as they can be entered directly. See example

IMPORTANT: When you want to trigger normal letter keys in combination with Ctrl Alt Shift, you *MUST* use lowercase versions of the letters, or a SHIFT key will be simulated.

To simulate the press and release of a modifier key then the key symbol must be the only character in the Keys string. See example ...

...(there's more).
__________________________________________
This new functionality is provided by the TPushKeys component by Alan Warriner which encapsulates, and extends, Christopher Latta's PushKeys code (alan.warriner@bigfoot.com, www.alan-warriner.co.uk)
I think I now better understand why you embedded TPushKeys functionality in LBC.
Seems pretty nifty.

kimbriki

  • Participant
  • Joined in 2016
  • *
  • Posts: 9
Re: Can't get Sendkeys to work
« Reply #5 on: September 23, 2018, 02:09 AM »
You little beauty! - Thanks guys! :Thmbsup:

Original address: https://www.donationcoder.com/forum/index.php?topic=46422.0