"input" command doesn't get the pressed key (resolved)

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
rhl
Posts: 29
Joined: 19 Apr 2020, 16:01

"input" command doesn't get the pressed key (resolved)

17 Apr 2021, 07:43

I'd like to share another little find of mine. Allow, here again, for my remark that admins should integrate such little tricks and hints into the help file (here: into the "send" item), where they could be found much easier when needed. So:

I have assigned even "regular" a...z / 1...0 keys to routines, for special situations; as I said in another hint, this is possible on a fast pc, even for quite fast typing:

Code: Select all

$a::
if ...
    gosub, ...
else
    send, a ; so this should be sendevent, a
return
Then, I have, in some other routine,

Code: Select all

input, e, L1 T1.3, {esc}
; maxlength=1 char, timeout=1.3s, esc will terminate
if ( errorlevel != "Max" )
    return
if ( e = "..." )
etc.
This routine works for e = b...z or 0...9, but NOT for e = a; obviously, the above assignment blocks the input within the "input" command, even when the special condition of that assignment above is not met.

Thus, I tried the different variants of "send", with the result that send, sendinput, sendplay, sendraw in a key assignment all prevent sending the keystroke within the "input" command, whilst sendevent does not; this behavior is persistent between different keys, "a" being just an example here. Hence:

If you intent to also use a key within the "input" command, use sendevent to send the key in a possible key assignment for that key.
User avatar
boiler
Posts: 16931
Joined: 21 Dec 2014, 02:44

Re: "input" command doesn't get the pressed key (resolved)

17 Apr 2021, 08:43

It seems that this should go in the Tips and Tricks sub-forum instead of this sub-forum (and also not in the documentation/help file).

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Chunjee, mikeyww, scriptor2016 and 267 guests