Right-click capture + left click using autohotkey; unexpected behavior

I want to capture the key event of "right-clicking and then left-clicking." No problem with autohotkey. However, I am having problems letting the right mouse button work independently.

1) it works:

RButton & LButton::
    Send X
Return

works as expected:

  • If I press the right mouse button, then the left mouse button, "X" is sent to the active window
  • event in the right-click function is captured Authotkey: a context menu appears no , only when I push the right mouse button. This is the intended result.

2) it works

~RButton & LButton::
    Send Y
Return

works as expected:

  • If I press the right mouse button, then the left mouse button, "Y" is sent to the active window
  • Authotkey: , . .

3) .

(: )

#If WinActive("ahk_class MozillaWindowClass")

RButton & LButton::
    Send X
Return


#If !WinActive("ahk_class MozillaWindowClass")
~RButton & LButton::
    Send Y
Return

, :

  • Firefox X, left-right Y
  • ,

?


:

: + RButton & LButton. , , , / , , , , autohotkey. , mouseevents, autohotkey, ~RButton & LButton ~

+3
1

, !

Hotkey, LButton, off

#IfWinActive ahk_class MozillaWindowClass
RButton & LButton::
    Send X
Return

RButton::return

#IfWinNotActive ahk_class MozillaWindowClass
~$RButton::
Hotkey, LButton, on
while GetKeyState("RButton", "P") {
    continue
    }
Hotkey, LButton, off
Return

LButton::Send Y
Return

RButton . RButton, LButton , RButton . RButton ~, .

LButton .

{RButton Down} {RButton Up} .

, , Autohotkey, , ... , , . .

, , - , #IfWin[Not]Active.


. ( ):

( ), "" . Numpad0, , :

Numpad0 & Numpad1::MsgBox You pressed Numpad1 while holding down Numpad0.
Numpad0 & Numpad2::Run Notepad

Numpad0 ; Numpad0 / , . , script Numpad0 , :

Numpad0::WinMaximize A   ; Maximize the active/foreground window.
Numpad0::Send {Numpad0}  ; Make the release of Numpad0 produce a Numpad0 keystroke. See comment below.

, Numpad0 , , Numpad0 .

, :

#If WinActive("ahk_class MozillaWindowClass")

RButton & LButton::
    Send X
Return

RButton::return

#If !WinActive("ahk_class MozillaWindowClass")
RButton & LButton::
    Send Y
Return

RButton::Send {RButton}

RButton , WinActive, , (. ): RButton::return


Autohotkey, Autohotkey_L, #If, . , .

#IfWinActive ahk_class MozillaWindowClass
RButton & LButton::
    Send X
Return

RButton::return


#IfWinNotActive ahk_class MozillaWindowClass
RButton & LButton::
    Send Y
Return

RButton::Send {RButton}

, , (NotActive), Firefox:

  • RButton
  • Firefox ,
  • < > (RButton , , , )
  • Firefox
  • < > ( )
  • RButton , RButton . Firefox RButton Firefox RButton.

, Firefox, , .

, IfWinNotActive RButton, .

+3

All Articles