Let me start with the script:
Code: Select all
XButton1 & RButton:: ; <-- Close tab/document or program
MouseGetPos,,,Winid, ControlClass
WinActivate, ahk_id %Winid%
KeyWait RButton ;only on release, so we can still cancel
if getKeyState("Alt","P")
WinClose, ahk_id %Winid%;,,1 ; 1 seconds wait, allow cancel
else
;Traytip,, ^w
Send ^w
KeyWait XButton1 ; Please no Browser_Back afterwards
return
RButton & WheelUp::Send {PgUp}
RButton & WheelDown::Send {PgDn}
RButton::RButton ; restore the original RButton function = release without others, do normal
- As is, the XButton1 & RButton doesn't work on some programs, because the context menu is poping up, and then the ^w is sent to the contextmenu, not to the program
- If I remove the RButton::RButton, it works again, but then I have no context menu, ever, but I want it when no other things are pressed down
Thanks for some insight