Remapping Numpad keys as Shift, Alt

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
TheSuperbacon
Posts: 4
Joined: 10 Dec 2017, 08:10

Remapping Numpad keys as Shift, Alt

10 Dec 2017, 08:24

Hey folks,

I'm setting my PS/2 Numpad up as a Photoshop hotkey device thing - basically remapping the keys to all the most commonly used tools and functions.
However I'm struggling with one combo - Photoshop's HUD Color Picker. Default key combo is Shift+Alt+RButton, and it's not remappable within Photoshop.
I'm trying to get this combo mapped to either a single Numpad key, or each key in the combo mapped individually to the keys in the combo. The problem is that the modifier keys either don't fire, or they stick down and have to be unstuck by hitting their real-key counterparts.

I've tried

Code: Select all

Numpad7::+!RButton
but the combo doesn't register.

I've also tried

Code: Select all

Numpad7::+
Numpad8::!
Numpad9::RButton
as well as

Code: Select all

Numpad7:: Send {Shift}
Numpad7 Up:: Send  {Shift Up}
but the keys still either don't register or get (virtually) stuck down.


Any ideas? Is this a code issue, an AHK issue, or a Windows issue that I'd also encounter using a Razer (etc) macro product?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Remapping Numpad keys as Shift, Alt

10 Dec 2017, 09:13

- Here are some possibilities. Cheers.

Code: Select all

Numpad7::+!RButton
NumpadHome::+!RButton
Numpad7::Send, {Shift Down}{Alt Down}{RButton}{Shift Up}{Alt Up}
NumpadHome::Send, {Shift Down}{Alt Down}{RButton}{Shift Up}{Alt Up}
Numpad7::Send, {Shift Down}{Alt Down}{Click right}{Shift Up}{Alt Up}
NumpadHome::Send, {Shift Down}{Alt Down}{Click right}{Shift Up}{Alt Up}
- You can't use all of these at the same time, because that would be defining the same hotkey more than once.
- For the Numpad keys, Numpad7 works when NumLock is on, NumpadHome works when NumLock is off.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
TheSuperbacon
Posts: 4
Joined: 10 Dec 2017, 08:10

Re: Remapping Numpad keys as Shift, Alt

10 Dec 2017, 15:52

Cheers for the reply!
The issue is that some elements of the Shift+Alt+RButton combo need to be held down while the color picker is active on the screen. I'll try to describe how the color picker works (https://i.ytimg.com/vi/V57yBMWKelQ/maxresdefault.jpg)

Hold Shift+Ctrl then Right Click.
Color picker appears.
Right Click must be held down for the color picker to remain on the screen. Shift+Ctrl can be released, but holding them down while color picker is active won't interfere with the program's function.
While holding Right Click, the user can hold Space to stop the mouse cursor from interacting with the color picker, allowing the user to move the cursor between the inner Brightness/Saturation box and the outer Hue wheel.

So what we're running into is that when a modifier key is held down, the system isn't being told (or isn't recognizing) that it should be releasing that key
TheSuperbacon
Posts: 4
Joined: 10 Dec 2017, 08:10

Re: Remapping Numpad keys as Shift, Alt

10 Dec 2017, 16:07

Thanks so much for the code! I messed up - I've looked into the key combo a little more, and should have better explained how the HUD color picker key combo works.

The user presses Alt+Shift, then RButton.
The user can release Alt+Shift, but must keep the RButton held for the duration of the use of the color picker.
The color picker consists of an inner box for Brightness/Saturation selection, and an outer ring for Hue selection.
The user can disengage the cursor from the color picker UI, allowing them to move the mouse between the inner box and outer ring, by holding SPACE.
Release RButton when finished with the picker.

So the RButton needs to be held down for the duration, however my attempts at this (as listed above) don't seem to work
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Remapping Numpad keys as Shift, Alt

10 Dec 2017, 17:27

You can do {RButton Down} and {RButton Up}, which might help you accomplish your aim.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Remapping Numpad keys as Shift, Alt

10 Dec 2017, 17:39

I would envision using jeeswg's latest suggestion across two hotkeys: The Numpad7:: hotkey should use the {RButton Down} whereas a new Numpad7 up:: hotkey should use {RButton Up}. (The Shift/Alt down and release can all be part of the first Numpad7 hotkey.) (And duplicate for the NumpadHome hotkey so it works no matter the state of NumLock.)
scriptor2016
Posts: 860
Joined: 21 Dec 2015, 02:34

Re: Remapping Numpad keys as Shift, Alt

10 Dec 2017, 20:45

this works for me. You can still press Numpad2 as the hotkey, but make sure NumLock is turned OFF first. I don't know why, but if I use "Numpad2" as the hotkey, the script fails. Only "NumpadDown" works for me. This is an old code of mine, so I can't even remember why the "sleep, 50" is required or why "ctrl down/ctrl up" is needed, but for whatever reason, I had to use those lines in order to get it to work. Try it out and get back to me

Code: Select all

#IfWinActive, ahk_class Photoshop

~NumpadDown::
sendinput, {ctrl down}
sendinput, {shift down}  
sendinput, {alt down} 
sendinput, {Rbutton down}
Keywait, NumpadDown
sleep, 50
sendinput, {Rbutton up}
sendinput, {alt up}
sendinput, {shift up} 
sendinput, {ctrl up}
sleep, 50
return
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Remapping Numpad keys as Shift, Alt

11 Dec 2017, 00:59

Re. NumpadDown / Numpad2, I found that both work, but because of the tilde, both hotkeys allow the key to operate as usual, and so: NumpadDown will send Down as you hold it down, and Numpad2 will send 2 as you hold it down. If you remove the tilde from both of these hotkeys, they work nicely.

Code: Select all

~NumpadDown::
~Numpad2::
KeyWait, % InStr(A_ThisHotkey, "Down") ? "NumpadDown" : "Numpad2"
ToolTip, % A_Now " " A_MSec
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
TheSuperbacon
Posts: 4
Joined: 10 Dec 2017, 08:10

Re: Remapping Numpad keys as Shift, Alt

20 Jan 2018, 17:28

Sorry for the late reply guys! I really appreciate the advice - I'll give the proposed solutions a shot.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: filipemb, mikeyww and 182 guests