StrokesPlus.net
Welcome Guest! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
Rob Otter  
#1 Posted : Thursday, November 26, 2020 9:28:39 AM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
At least up to current version 0.3.9.9, I cannot specify several Hotkey combinations when Numpad keys are involved:

(Having NumLock switched on) all Numpad keys pressed alone or together with Ctrl are recognized correctly.
Combinations with Shift instead are not working for the 10 number keys and the DECIMAL key: Pressing Shift first is displayed correctly but as soon as I press one the mentioned keys their NumLock-off key is displayed while erasing Shift. Therefore, it is not possible to specify Shift-Decimal as a hotkey (or one of the other number keys with Shift).

What makes it even worse is, I can define i.e. Ctrl-DECIMAL (or Ctrl-Numpad1) but it is not executed.

No other Keyboard related software is running and I tried using a german and an english keyboard layout.
Rob  
#2 Posted : Friday, November 27, 2020 3:55:32 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,357
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 418 time(s) in 356 post(s)
Yeah, this is due to the way Windows works, where Shift overrides Num Lock:

https://devblogs.microsoft.com/oldnewthing/20040906-00/?p=37953

It would require changing the keyboard events and hotkeys are handled, not something I'm keen to do just yet BigGrin
Rob Otter  
#3 Posted : Friday, November 27, 2020 4:39:41 PM(UTC)
Rob Otter

Rank: Advanced Member

Reputation:

Groups: Approved
Joined: 10/26/2020(UTC)
Posts: 50
Germany
Location: Darmstadt

Thanks: 15 times
Was thanked: 2 time(s) in 2 post(s)
I feared you´d say something like that...
And I would have believed, if I would not have used this for years now in my beloved tool ac'tivaid (https://activaid.telgkamp.de/) which is based on AutoHotkey scripting language. Within this tool, it is possible to define hotkeys just be pressing them (just like in S+) and there, Shift-NumpadDot is recognized. Unfortunately, I have no idea why, as the source code is quite complex and the language syntax is crap.
Rob  
#4 Posted : Friday, November 27, 2020 4:41:52 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,357
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 418 time(s) in 356 post(s)
Yeah, I would have to monitor the keystrokes individually and account for those specific cases - which might not be terribly hard to do, so I'll tinker with it when I feel a burst of energy :)
Rob  
#5 Posted : Friday, November 27, 2020 4:55:03 PM(UTC)
Rob

Rank: Administration

Reputation:

Groups: Translators, Members, Administrators
Joined: 1/11/2018(UTC)
Posts: 1,357
United States
Location: Tampa, FL

Thanks: 28 times
Was thanked: 418 time(s) in 356 post(s)
However....you could use the keyboard hook event to handle this.

The example below would detect Shift+NUMPAD0 - though it's actually no different than Shift+Insert (on my US keyboard, that is).

Just have to have a timer to allow some time before setting the Shift key to released, since that happens instantly upon pressing Shift+NUMPAD0.
Code:
if(__spEngineWrapper.Engine.Name == sp.EngineList().Last().Engine.Name)
{
    var keyboardEventObj = sp.GetStoredObject("keyboardEvent");
    if(!keyboardEventObj.GetType().FullName.includes('EventConnection'))
    {
        //Bind to the asynchronous event (non-blocking)
        var keyboardEvent = KeyboardHook.OnKeyboardHookEventAsync.connect(
            function (sender, keyboardHookEvent) {
                try
                {
                    //If the Left or Right Shift key is pressed/released
                    if(keyboardHookEvent.Key == vk.LSHIFT || keyboardHookEvent.Key == vk.RSHIFT)
                    {
                        //Shift key is down
                        if(keyboardHookEvent.KeyState == KeyState.Down)
                        {
                            sp.StoreBool("ShiftDown", true);
                        }
                        else
                        {
                            sp.CreateTimer("ShiftWatch", 100, 100, `sp.StoreBool("ShiftDown", false);sp.DeleteTimer("ShiftWatch");`); 
                        }
                    }
                    if(keyboardHookEvent.Key == vk.INSERT && keyboardHookEvent.KeyState == KeyState.Down && sp.GetStoredBool("ShiftDown"))
                    {
                        sp.MessageBox("Shift+NUMPAD0 (Shift+Insert)", "Key");
                    }   
                }
                catch {}
            });
        sp.StoreObject("keyboardEvent", keyboardEvent);
    }
}
thanks 1 user thanked Rob for this useful post.
Rob Otter on 11/27/2020(UTC)
Users browsing this topic
Forum Jump  
You cannot post new topics in this forum.
You cannot reply to topics in this forum.
You cannot delete your posts in this forum.
You cannot edit your posts in this forum.
You cannot create polls in this forum.
You cannot vote in polls in this forum.