jaco0646 wrote:
You can reproduce the behavior in this code.
Code:
a::b ;remap
a & b::MsgBox,% A_ThisHotkey ;prefix
The remapped
a appears to do nothing because the prefix
a blocks its down event, so only the
a up hotkey fires, which in turn only produces
b up, which produces nothing.
Hi again,
That doesn't quite explain the problem. While your example does cause the same behaviour, it doesn't do so in the same context as my original script. Within the context of the ACTIVE #IfWinActive block, the "a::b" type of remapping was not used. In it's context it would be closer to the following:
Code:
a::send b ;remap
a & b::MsgBox,% A_ThisHotkey ;prefix
which does work for both "a" alone and "a & b". However, the following code prevent "a" alone from working:
Code:
#IfWinActive ahk_class CabinetWClass ; a Windows explorer window
a::c
#IfWinActive
a::send b ;remap
a & b::MsgBox,% A_ThisHotkey ;prefix
Here the "a::c" remap should only be active if an Explorer window is currently active. Therefore, if you attempt to type "a" while in a Notepad window, for instance, it should still work in principle. However, it does not, despite being in different contexts. The explanation you proposed of "a & b" inhibiting the "a" down press makes sense when they are operating in the same context, but doesn't make sense here becuase "a::send b" should override "a::c" unless Explorer is active.
The following code restores the correct behaviour of "a" in a non-Explorer window:
Code:
#IfWinActive ahk_class CabinetWClass
a::send c
#IfWinActive
a::send b ;remap
a & b::MsgBox,% A_ThisHotkey ;prefix
Note, if you run this and type "a" into a Notepad window you will get "b". If you type "a" into the address bar of an Explorer window you'll get "c". So it works when written this way.
Thanks.