Hi,
I know how to hook a key eg:
*n::
Run Notepad
return
but how would i abandon the key intercept?
example: I have a variable interceptNKey
interceptNKey := false
n::
if (interceptNKey = true) {
Run Notepad
return
}
if the interceptNKey is true the keypress successfully opens notepad, but if it's false the n is absorbed, whereas I would want n to function normally.
The only workaround I've found for now is to send n in an else statement like:
interceptNKey := false
n::
if (interceptNKey = true) {
Run Notepad
return
}
else {
send n
}
However this is not a real solution. Plus it doesn't work as the sent n is absorbed by the function and you end up in an infinite loop of n being pressed and absorbed by the hook then pressing n which is absorbed.
Surely there's just a way to break hook and allow the n key to continue to get through?
abort keyhook Topic is solved
Re: abort keyhook Topic is solved
Hallo,
try:
try:
Code: Select all
interceptNKey := false
#If interceptNKey ; means: If (interceptNKey = true)
n::Run Notepad
#If
Re: abort keyhook
You're a genius. That indeed seems to work well.Rohwedder wrote: ↑16 Apr 2021, 08:13Hallo,
try:Code: Select all
interceptNKey := false #If interceptNKey ; means: If (interceptNKey = true) n::Run Notepad #If
I didn't know about #if
many thanks
Who is online
Users browsing this forum: No registered users and 253 guests