Hello,
I don't understand the underlying logic about key stroke interception.
My example:
For a given application "A" I want a given key stroke to be intercepted and served. For all other application different from "A" I don't want the key stroke to be intercepted.
I found a way to do what I want but I'm not satisfied with the way for coding it:
;; I want the simple key pressed "d" to be a trigger when a given window, say "foo" is active.
;; For all other window different from "foo" I don't want anything done but the application behavior for that trigger.
$d::
IfWinActive, foo
{
MsgBox, do something
}
else
{ Send, d
}
return
I should have prefered the following encoding:
d::
IfWinActive, foo
{
MsgBox, do something
}
return
Regards,
Claude Bohlinger
Intercepting key strokes
Started by
bohlinger
, Mar 08 2004 09:19 AM
1 reply to this topic
#1
-
Posted 08 March 2004 - 09:19 AM
I know what you mean. As far as I can tell, it's impossible for the program to know whether you want a key to have it's native function or not. For the vast majority of hotkeys, the user does not want the hotkey to be "seen" by the active window. This is why the default behavior is to suppress (hide) the hotkey's own keystrokes. If you want to override that default, you have to code it yourself (as you did). I don't see that there's any other way to implement it.
However, one thing that may be useful to you is the following. Note the ~ prefix before the hotkey.
~d::
IfWinActive, foo
{
MsgBox, do something
}
return
What this does is make the letter D perform its native function while simultaneously activating the hotkey. However, this might be undesirable if if the "foo" window would receive the letter D and act upon it (if foo is a text editor, for example).
However, one thing that may be useful to you is the following. Note the ~ prefix before the hotkey.
~d::
IfWinActive, foo
{
MsgBox, do something
}
return
What this does is make the letter D perform its native function while simultaneously activating the hotkey. However, this might be undesirable if if the "foo" window would receive the letter D and act upon it (if foo is a text editor, for example).
#2
-
Posted 08 March 2004 - 01:44 PM