What am I doing wrong?
Autohotkey 1.0.48.05
RButton & MButton::Send {Volume_Mute} RButton & WheelUp::Send {Volume_Up} RButton & WheelDown::Send {Volume_Down}
RButton & MButton::Send {Volume_Mute} RButton & WheelUp::Send {Volume_Up} RButton & WheelDown::Send {Volume_Down}
~RButton & MButton::Send {Volume_Mute} ~RButton & WheelUp::Send {Volume_Up} ~RButton & WheelDown::Send {Volume_Down}Now, a problem with this is now every time you use one of these hotkeys you will have a context menu popping up.
Thanks a lot..The tilde "~" symbol allows a key to function normally even if it is a hotkey:
~RButton & MButton::Send {Volume_Mute} ~RButton & WheelUp::Send {Volume_Up} ~RButton & WheelDown::Send {Volume_Down}
I can live with that :?Now, a problem with this is now every time you use one of these hotkeys you will have a context menu popping up.
$RButton:: Send {RButton} Return RButton & MButton::Send {Volume_Mute} RButton & WheelUp::Send {Volume_Up} RButton & WheelDown::Send {Volume_Down}
Piece of cake :
$RButton:: Send {RButton} Return RButton & MButton::Send {Volume_Mute} RButton & WheelUp::Send {Volume_Up} RButton & WheelDown::Send {Volume_Down}
#If MouseIsOver("ahk_class Shell_TrayWnd") ~LButton & WheelUp:: Send {Volume_Up} Return ~LButton & WheelDown:: Send {Volume_Down} Return ~LButton & MButton:: Send {Volume_Mute} Return MouseIsOver(WinTitle) { MouseGetPos,,, Win return WinExist(WinTitle . " ahk_id " . Win) }
#If MouseIsOver("ahk_class Shell_TrayWnd") $RButton:: Send {RButton} Return RButton & WheelUp:: Send {Volume_Up} Return RButton & WheelDown:: Send {Volume_Down} Return RButton & MButton:: Send {Volume_Mute} Return MouseIsOver(WinTitle) { MouseGetPos,,, Win return WinExist(WinTitle . " ahk_id " . Win) }
[color=green]; Concept: Implement RButton as a modifier for other hotkeys[/color] [color=green]; by monitoring the mouse position and button state.[/color] [color=green]; Requires: ; - AutoHotkey (any version should be fine) ; - A mouse with a wheel ; - Two or more fingers (optional but recommended)[/color] [color=green]; Start with wheel/MButton hotkeys disabled:[/color] gosub DisableRButtonHotkeys RButton:: [color=green]; Enable hotkeys while RButton is down.[/color] Hotkey WheelUp, On Hotkey WheelDown, On Hotkey MButton, On [color=green]; Determine initial mouse position.[/color] CoordMode Mouse, Screen MouseGetPos x1, y1 Loop { [color=green]; If another hotkey has been triggered...[/color] if (A_ThisHotkey != "RButton") { [color=green]; Stop monitoring the other conditions (below). Just wait[/color] [color=green]; for the button to be released, then disable the hotkeys.[/color] KeyWait RButton break } [color=green]; If button has been released...[/color] if !GetKeyState("RButton", "P") { [color=green]; Press and release the button.[/color] MouseClick R [color=green]; Break out of the loop to disable the hotkeys.[/color] break } MouseGetPos x2, y2 [color=green]; If mouse has moved...[/color] if (x1 != x2 || y1 != y2) { [color=green]; Set speed to "instant" for best results.[/color] SetDefaultMouseSpeed 0 [color=green]; Press the button down (at the initial mouse position).[/color] Click Right Down %x1%, %y1% [color=green]; Move back to where the user had moved the mouse.[/color] MouseMove x2, y2 [color=green]; Wait for the button to be released.[/color] KeyWait RButton [color=green]; Release the button.[/color] Click Right Up [color=green]; Break out of the loop to disable the hotkeys.[/color] break } [color=green]; Yield CPU time to other applications.[/color] Sleep 1 } [color=green]; Disable the hotkeys.[/color] DisableRButtonHotkeys: Hotkey WheelUp, Off Hotkey WheelDown, Off Hotkey MButton, Off return WheelUp:: Send {Volume_Up} WheelDown:: Send {Volume_Down} MButton:: Send {Volume_Mute}