[v2 beta]HotIfWinActive level is max than InputHook?

Get help with using AutoHotkey (v2 or newer) and its commands and hotkeys
User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

[v2 beta]HotIfWinActive level is max than InputHook?

Post by hyaray » 17 Oct 2021, 11:36

Code: Select all

HotIfWinActive("ahk_class Notepad")
hotkey("1",(p*)=>msgbox(1)) ;TODO key "1" can't stop InputHook

ih := InputHook()
ih.VisibleNonText := false
ih.VisibleText := false
ih.KeyOpt("{All}", "E")
tooltip("1111111111")
ih.start()
ih.wait()
tooltip
I want InputHook can stop any key press!! :headwall: :headwall:
Am I did something wrong??
thanks a lot!!
Last edited by hyaray on 19 Oct 2021, 21:27, edited 1 time in total.

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

Re: HotIfWinActive level is max than inputhook?

Post by swagfag » 17 Oct 2021, 18:57

i doubt it was ever intended for InputHook() to be able to override the script's own hook hotkeys

u can:
  • have SendMessage() to a separate running script to execute the InputHook(), but this isnt 100% safe against the keybdhook not ever getting overridden and thus placed lower in the stack
  • turn off all of ur hook hotkeys u want captured(safer). reenable them when the InputHook() expires

User avatar
hyaray
Posts: 85
Joined: 20 Jun 2015, 01:37
Contact:

Re: HotIfWinActive level is max than inputhook?

Post by hyaray » 17 Oct 2021, 21:25

@swagfag
hi, thanks!
running a new script worked! but not perfect. :)

in fact, I never need hotkey when I use InputHook()
InputHook() should keep option for recover all hotkeys. :offtopic: :offtopic:

Post Reply

Return to “Ask for Help (v2)”