0

I have a key combination written as ~XButton1 & XButton2::. When I press the combination, the XButton1 event isn't filtered out. This can cause, for example, my browser to go back a page when I don't want it to.

According to the docs, removing the ~ will cause the keys not to be passed on to the rest of the system. When I do that, however, XButton1 is never passed to the system, whether I finish the combo or not.

Here's the behavior I'd like to see:

AHk should buffer the first XButton1 event when it's recieved. If I do press XButton2, pass on nothing to the system. But, if I don't press XButton2, send a quick XButton1 down-and-up.

Is there any way to get this behavior?

2 Answers 2

0

As explained in the AutoHotkey documentation about the &, using the a & b pattern causes the a key to lose its original function. To make the a key work on release when it's used alone, you can make a hotkey that maps back to itself like a::Send {a}.

In your case, you might try something like

XButton1 & XButton2:: whatever you want
XButton1::Send {XButton1}

1
  • This was it. I'm not sure how I missed that section. Thanks!
    – zildjohn01
    Aug 24, 2010 at 17:47
0

You should try playing with the KeyWait function and the A_PriorHotKey and A_TimeSincePriorHotkey variables, as explained in the example #4 of the KeyWait documentation.

; Example #4: Detects when a key has been double-pressed (similar to double-click).
; KeyWait is used to stop the keyboard's auto-repeat feature from creating an unwanted
; double-press when you hold down the RControl key to modify another key.  It does this by
; keeping the hotkey's thread running, which blocks the auto-repeats by relying upon
; #MaxThreadsPerHotkey being at its default setting of 1.
; Note: There is a more elaborate script to distinguish between single, double, and
; triple-presses at the bottom of the SetTimer page.

~RControl::
if (A_PriorHotkey <> "~RControl" or A_TimeSincePriorHotkey > 400)
{
    ; Too much time between presses, so this isn't a double-press.
    KeyWait, RControl
    return
}
MsgBox You double-pressed the right control key.
return

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .