topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • Saturday November 9, 2024, 8:43 am
  • Proudly celebrating 15+ years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Can't get Sendkeys to work  (Read 5356 times)

kimbriki

  • Participant
  • Joined in 2016
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Can't get Sendkeys to work
« on: September 21, 2018, 12: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

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Can't get Sendkeys to work
« Reply #1 on: September 21, 2018, 03: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
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Can't get Sendkeys to work
« Reply #2 on: September 21, 2018, 04: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,913
    • View Profile
    • Mouser's Software Zone on DonationCoder.com
    • Read more about this member.
    • Donate to Member
Re: Can't get Sendkeys to work
« Reply #3 on: September 21, 2018, 09:48 PM »
maybe try ^(+(b))

IainB

  • Supporting Member
  • Joined in 2008
  • **
  • Posts: 7,544
  • @Slartibartfarst
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Can't get Sendkeys to work
« Reply #4 on: September 22, 2018, 01: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.)
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 ([email protected], 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
  • *
  • default avatar
  • Posts: 9
    • View Profile
    • Donate to Member
Re: Can't get Sendkeys to work
« Reply #5 on: September 22, 2018, 09:09 PM »
You little beauty! - Thanks guys! :Thmbsup: