InputHook unable to suppress hotkey of the same script

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
ducklord
Posts: 25
Joined: 06 Jan 2022, 08:14

InputHook unable to suppress hotkey of the same script

Post by ducklord » 06 Dec 2022, 06:51

Hi, by using code below, when scanning a barcode with data "$asdf", it would execute BarcodeScan and at the same time triggering the "a" hotkey. It is working fine if I disable the relevant hotkeys. However, I would like to keep them. Tentatively adding Suspend to BarcodeScan or making those hotkeys context-sensitive (e.g: #If !ih) may solve the issue.

Is there any other solution? Perhaps any option for InputHook which could fully suppress all the inputs?
Thanks.

Code: Select all

;sample data := "$asdf`n"

ih := InputHook("T0.3", "{Enter}")
,ih.VisibleNonText := False
Hotkey, $, BarcodeScan, P1
return

BarcodeScan:
ih.Start()
msgbox % ih.Wait()
return

;Hotkeys
1::
2::
3::
a::
b::
c::
Enter::
msgbox % A_ThisHotkey " is pressed."
return

swagfag
Posts: 6222
Joined: 11 Jan 2017, 17:59

Re: InputHook unable to suppress hotkey of the same script

Post by swagfag » 27 Dec 2022, 22:04

and what exactly is producing the input stream of keystrokes $asdf{Enter} that are supposed to be triggering the hook? i somehow doubt ure typing this urself manually in the span of 300ms

Post Reply

Return to “Ask for Help (v1)”