SendMode Input + #InputLevel 1 + remap = hotstring fails Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
andraaspar
Posts: 7
Joined: 16 Mar 2021, 07:13

SendMode Input + #InputLevel 1 + remap = hotstring fails

Post by andraaspar » 26 Apr 2021, 09:41

[Moderator's note: Topic moved from Bug Reports.]

Hi,

I'm trying to make the following script work:

Code: Select all

SendMode Input
#InputLevel 1
z::y
y::z
::szia::hi
It is expected to swap Z and Y and then replace ‘szia’ with ‘hi’ as a hotstring. The hotstring does not trigger.

The first line causes this to fail. The website suggests that SendMode Input is used for new scripts. Any suggestions are welcome.
gregster
Posts: 8921
Joined: 30 Sep 2013, 06:48

Re: SendMode Input + #InputLevel 1 + remap = hotstring fails

Post by gregster » 26 Apr 2021, 11:44

Can't reproduce on latest release v1.1.33.08 (afaik, there have been recent fixes regarding #Inputlevel.)
Here, the hotstring triggers.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: SendMode Input + #InputLevel 1 + remap = hotstring fails

Post by lexikos » 26 Apr 2021, 23:36

This one is not a bug.
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.
@gregster andraaspar reported those bugs.
andraaspar
Posts: 7
Joined: 16 Mar 2021, 07:13

Re: SendMode Input + #InputLevel 1 + remap = hotstring fails

Post by andraaspar » 06 May 2021, 03:10

Is there a workaround I could use, or is SendInput mutually exclusive with hotstrings?
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: SendMode Input + #InputLevel 1 + remap = hotstring fails

Post by lexikos » 06 May 2021, 04:12

If SendInput could be made to ignore the presence of a hook, there would be no point, because
... the presence of an external hook disables all of SendInput's advantages, making it inferior to both SendPlay and SendEvent.
Just don't use SendInput if you want to trigger hotkeys/hotstrings.

If you want to remap a key using a non-default Send mode, write it out as a set of two hotkeys instead.
andraaspar
Posts: 7
Joined: 16 Mar 2021, 07:13

Re: SendMode Input + #InputLevel 1 + remap = hotstring fails  Topic is solved

Post by andraaspar » 07 May 2021, 06:04

I see. So I could use this:

Code: Select all

SendMode Input
#InputLevel 1

*z::
	SetKeyDelay -1
	SendEvent {Blind}{y DownR}
	return
*z up::
	SetKeyDelay -1
	SendEvent {Blind}{y up}
	return

*y::
	SetKeyDelay -1
	SendEvent {Blind}{z DownR}
	return
*y up::
	SetKeyDelay -1
	SendEvent {Blind}{z up}
	return

::szia::hi
Except that Z and Y will not benefit from the speed and reliability of SendInput anymore. Thanks for the explanation.
lexikos
Posts: 9560
Joined: 30 Sep 2013, 04:07
Contact:

Re: SendMode Input + #InputLevel 1 + remap = hotstring fails

Post by lexikos » 07 May 2021, 19:21

It's very unlikely that it benefited from the "speed and reliability" of SendInput in the first place, as it only ever sends a single event at a time (y down or y up).
Post Reply

Return to “Ask for Help (v1)”