Simplifying Remapped Custom Combinations
Posted: 09 May 2020, 12:29
This code works flawlessly by turning Numpad0 in a Control modifier key and NumpadDot in a Shift modifier key when working with the Numpad Keys. It even makes it possible to use Numpad0 & NumpadDot in conjunction to gain a Control+Shift modification (if the keyboard rollover has a high enough count).
But most importantly this specific syntax does not destroy the native function of the Numpad0 key itself and moreover it is also still possible to press LControl+Numpad0.
The only known limitation is the disabled software repetition function for the prefix keys, which I personally do not need.
All original credit goes to the author of this thread: https://autohotkey.com/board/topic/83755-using-an-arbitrary-key-as-a-modifier-without-sacrificing-it/
I am now looking for a way to simplify this code for further implementations. I want to repeat all of this with NumpadEnter and other keys for example.
Also I am thinking about applying this to the {Space} key to get something like Control+[pressed key] or Shift+[pressed key] maybe. I am imagining there must be a more simple way to achieve this (at least when always using the same modification) than to write out all combinations like so:
I want to emphasize though that this syntax is the only one I have found to work without any unwanted limitations.
But most importantly this specific syntax does not destroy the native function of the Numpad0 key itself and moreover it is also still possible to press LControl+Numpad0.
The only known limitation is the disabled software repetition function for the prefix keys, which I personally do not need.
All original credit goes to the author of this thread: https://autohotkey.com/board/topic/83755-using-an-arbitrary-key-as-a-modifier-without-sacrificing-it/
Code: Select all
#singleinstance, force
Pause::Suspend
~^s::reload
numpad0 & F1::Return ; Make the release of Numpad0 produce a Numpad0 keystroke.
*numpad0::Send {Blind}{numpad0} ; Send it explicitly when no other key is pressed before letting go, including any modifiers being held
#If GetKeyState("numpad0", "p")
{
;Control+NumpadN
$numpad1::Send {Ctrl down}{numpad1}{Ctrl up}
$numpad2::Send {Ctrl down}{numpad2}{Ctrl up}
$numpad3::Send {Ctrl down}{numpad3}{Ctrl up}
$numpad4::Send {Ctrl down}{numpad4}{Ctrl up}
$numpad5::Send {Ctrl down}{numpad5}{Ctrl up}
$numpad6::Send {Ctrl down}{numpad6}{Ctrl up}
$numpad7::Send {Ctrl down}{numpad7}{Ctrl up}
$numpad8::Send {Ctrl down}{numpad8}{Ctrl up}
$numpad9::Send {Ctrl down}{numpad9}{Ctrl up}
$NumpadAdd::Send {Ctrl down}{NumpadAdd}{Ctrl up}
$NumpadSub::Send {Ctrl down}{NumpadSub}{Ctrl up}
NumpadDot::Return ;avoiding collision with Numpad0
;Control+Shift+NumpadN
NumpadDot & numpad1::Send {Ctrl down}{Shift down}{numpad1}{Shift up}{Ctrl up}
NumpadDot & numpad2::Send {Ctrl down}{Shift down}{numpad2}{Shift up}{Ctrl up}
NumpadDot & numpad3::Send {Ctrl down}{Shift down}{numpad3}{Shift up}{Ctrl up}
NumpadDot & numpad4::Send {Ctrl down}{Shift down}{numpad4}{Shift up}{Ctrl up}
NumpadDot & numpad5::Send {Ctrl down}{Shift down}{numpad5}{Shift up}{Ctrl up}
NumpadDot & numpad6::Send {Ctrl down}{Shift down}{numpad6}{Shift up}{Ctrl up}
NumpadDot & numpad7::Send {Ctrl down}{Shift down}{numpad7}{Shift up}{Ctrl up}
NumpadDot & numpad8::Send {Ctrl down}{Shift down}{numpad8}{Shift up}{Ctrl up}
NumpadDot & numpad9::Send {Ctrl down}{Shift down}{numpad9}{Shift up}{Ctrl up}
}
#If
NumpadDot & F1::Return
*NumpadDot::Send {Blind}{NumpadDot}
#If GetKeyState("NumpadDot", "p")
{
;Shift+NumpadN
$numpad1::Send {Shift down}{numpad1}{Shift up}
$numpad2::Send {Shift down}{numpad2}{Shift up}
$numpad3::Send {Shift down}{numpad3}{Shift up}
$numpad4::Send {Shift down}{numpad4}{Shift up}
$numpad5::Send {Shift down}{numpad5}{Shift up}
$numpad6::Send {Shift down}{numpad6}{Shift up}
$numpad7::Send {Shift down}{numpad7}{Shift up}
$numpad8::Send {Shift down}{numpad8}{Shift up}
$numpad9::Send {Shift down}{numpad9}{Shift up}
$NumpadAdd::Send {Shift down}{NumpadAdd}{Shift up}
$NumpadSub::Send {Shift down}{NumpadSub}{Shift up}
Numpad0::Return ;avoiding collision with NumpadDot
}
#If
I am now looking for a way to simplify this code for further implementations. I want to repeat all of this with NumpadEnter and other keys for example.
Also I am thinking about applying this to the {Space} key to get something like Control+[pressed key] or Shift+[pressed key] maybe. I am imagining there must be a more simple way to achieve this (at least when always using the same modification) than to write out all combinations like so:
Code: Select all
Space & F1::Return
*Space::Send {Blind}{Space}
#If GetKeyState("Space", "p")
{ q::Send {Ctrl down}{q}{Ctrl up}
w::Send {Ctrl down}{w}{Ctrl up}
e::Send {Ctrl down}{e}{Ctrl up}
r::Send {Ctrl down}{r}{Ctrl up}
t::Send {Ctrl down}{t}{Ctrl up}
y::Send {Ctrl down}{y}{Ctrl up}
;and so on for all common keys
}
#If