I want to swap LAlt with LCtrl, which is straightforward enough by itself:
#SingleInstance Force
#UseHook
#MenuMaskKey VKFF
SetWorkingDir %A_ScriptDir%
SendMode Input
LAlt::RCtrl
RCtrl::LAlt
It just works. But the main reason I want to do it is to block LAlt's function as a menu key. I want combinations of the physical LAlt button with J, K, L, I to function as Arrow keys and LAlt not being completely silenced means I cannot use those to navigate context menus — since Alt closes them on key-down. And it is exactly what happens if I add <!i::Send {Up}
to the script. Now LAlt isn't blocked on key-down — pressing it now shows underscores up top under menu option names, which wasn't the case previously, and any open context menu will be closed.
So my main question is: Why does this happen? Why do (additional) hotkeys break remappings and what ways are there of preventing\working around\dealing with that?
Now, one way I know how to fix this is to use >^i::Send {Up}
and, since the hotkey doesn't work otherwise, remove SendMode Input
. But the docs say SendInput
is better and thus I chose another way — split the script in two and have one run the other.
; Script One: ; Script Two (two.ahk):
#SingleInstance Force #SingleInstance Force
#UseHook #UseHook
#MenuMaskKey VKFF #MenuMaskKey VKFF
SetWorkingDir %A_ScriptDir% SetWorkingDir %A_ScriptDir%
SendMode Input SendMode Input
Run two.ahk >^i::Send {RCtrl up}{Up}{RCtrl down}
>^k::Send {RCtrl up}{Down}{RCtrl down}
LAlt::RCtrl >^j::Send {RCtrl up}{Left}{RCtrl down}
RCtrl::LAlt >^l::Send {RCtrl up}{Right}{RCtrl down}
Capslock::Backspace >^o::Send +{F10}
This seems to work fine, but is there a better way I can achieve what I want? Like doing it in one file, keeping SendMode Input
and not having to neutralize RCtrl with {RCtrl up} ... {RCtrl down}
?