Remap + hotstring not working Topic is solved

Report problems with documented functionality
andraaspar
Posts: 7
Joined: 16 Mar 2021, 07:13

Remap + hotstring not working

Post by andraaspar » 16 Mar 2021, 07:27

Code: Select all

; SendMode, Input

; #InputLevel, 1

z::y
y::z

::szia::hello
Hi everyone,

I'm trying to make this simple script work. It should switch the keys Z and Y, and define a hotstring that contains Z. The hotstring does not trigger.
  • It used to work, but it seems to be broken recently.
  • The commented out lines do not help. InputLevel disables the keys Z and Y completely (can't type Z or Y at all). SendMode reenables them, but the hotstring does not trigger.
  • I've been through the docs, and tried various other things, but had no success.
Any suggestions are welcome.

lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: Remap + hotstring not working

Post by lexikos » 20 Apr 2021, 06:35

It shouldn't work without #InputLevel 1 or SendLevel 1 + Send because events at SendLevel 0 (the default) are not collected by the hotstring recognizer.
By default, hook hotkeys and hotstrings ignore keyboard and mouse events generated by any AutoHotkey script.
Source: SendLevel - Syntax & Usage | AutoHotkey

It does not work with #InputLevel 1 because a bug causes the event to be suppressed if it matched a hotkey which is disabled by #InputLevel.

You can work around it by defining a fallback global variant with the no-suppress prefix.

Code: Select all

#If true
#InputLevel 1
z::y
y::z

#If
#InputLevel 0
~*z::
~*z Up::
~*y::
~*y Up::
return

::szia::hello

SendMode Input may "reenable" the hotkeys because...
SendInput is affected by SendLevel, but the script's own hook hotkeys cannot be activated while a SendInput is in progress, since it temporarily deactivates the hook. However, when Send or SendInput reverts to SendEvent, it is able to activate the script's own hotkeys.
Source: SendLevel - Syntax & Usage | AutoHotkey

lexikos
Posts: 9494
Joined: 30 Sep 2013, 04:07
Contact:

Re: Remap + hotstring not working  Topic is solved

Post by lexikos » 21 Apr 2021, 02:53

Fixed by v1.1.33.07.

andraaspar
Posts: 7
Joined: 16 Mar 2021, 07:13

Re: Remap + hotstring not working

Post by andraaspar » 22 Apr 2021, 02:34

Thank you for the fix!

Post Reply

Return to “Bug Reports”