Problem NumPad::Shift

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
flymatze
Posts: 1
Joined: 20 Feb 2018, 05:31

Problem NumPad::Shift

20 Feb 2018, 05:49

Hey Guys,

i´m new at AutoHotkey and got Problems with my first script.
It´s verry simple and i just want to get my favorit Photoshop Shortkeys to my NumPad. Everything is working fine, but not the Shift function.
I wrote this little Line:
NumPad3::LShift
But when i´m pressing the NumPad3, the Shift locks! and didnt release anymore..so i got the Shift the whole time and not just if i press NumPad3.

Here is my complete script:

#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.

#IfWinActive
Numpad1::Ctrl
Numpad2::Alt
Numpad3::LShift
Numpad4::send {Ctrl}^i
Numpad5::send {Ctrl}^z
Numpad6::send {Ctrl}^c
Numpad7::send {Ctrl}^j
Numpad8::send {Ctrl}^a
Numpad9::send {Ctrl}^d

It works fine with Ctrl and Alt. But Shift dosnt work.

Hope you can help me. I searched in the web but didnt find a solution that works.
Noesis
Posts: 301
Joined: 26 Apr 2014, 07:57

Re: Problem NumPad::Shift

21 Feb 2018, 08:16

This is due to the way the Numpad is implemented in windows when Numlock is on. When NumLock is on (which it must be on, otherwise you'd be using the other numpad variants for the key names, like NumpadUp etc), and shift is pressed, the numpad keys don't type numbers but instead act like they would when numlock is off, so in you're case, numpad3 goes down, and shift is pressed but now since shift is pressed, Numpad3's key name has become NumpadPageDn, meaning shift is never released, because ahk never sees Numpad3 go back up, instead NumpadPageDn went up, and is also what goes down if pressed again because shift is still down as far as windows is concerned, hence shift is locked down. (FYI: you could press the real shift keys to unlock it however, I doubt that's what you want).

To fix it you'll need to use the same hotkeys using the variant names for each of the numpad keys. either 1) with the above hotkeys, or 2) instead of the above hotkeys.
if you choose 1) it should work regardless of the Numlock setting, while if you choose 2) it will only work when Numpad is off.
User avatar
Nwb
Posts: 444
Joined: 29 Nov 2016, 08:56

Re: Problem NumPad::Shift

21 Feb 2018, 08:34

I know there is a solution for this that has something to do with the UP modifier.
I am your average ahk newbie. Just.. a tat more cute. ;)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 250 guests