Some mouse shortcuts in AutoHotKey

Some personally commonly used Autohotkey mouse shortcuts.

Implementing Alt+Tab window switching effect by clicking the left and right mouse buttons.

; Mouse left and right buttons for window switching, click the left button first and then the right button
~LButton & RButton::AltTab
~LButton & MButton::MsgBox, hello

Quickly exit the current window using the mouse and keyboard

; Pressing the left mouse button and the Enter key triggers the exit of the application
~LButton & Enter:: 
    ExitApp

Scrolling the mouse on the taskbar to control the volume

; Scroll the mouse wheel over the taskbar to adjust volume, press down the wheel to mute
~WheelUp:: 
    if (ExistClass("ahk_class Shell_TrayWnd") = 1) 
        Send, {Volume_Up} 
    Return 

~WheelDown:: 
    if (ExistClass("ahk_class Shell_TrayWnd") = 1) 
        Send, {Volume_Down} 
    Return 

~MButton:: 
    if (ExistClass("ahk_class Shell_TrayWnd") = 1) 
        Send, {Volume_Mute} 
    Return 

ExistClass(class) 
{ 
    MouseGetPos,,,win 
    WinGet, winid, ID, %class% 
    if win = %winid% 
        Return, 1 
    Else 
        Return, 0 
}

Shift + Scroll Wheel for Horizontal Scrolling / Cursor Selection

; Shift + Scroll Wheel for Horizontal Scrolling / Cursor Selection
+WheelUp::
    SetScrollLockState, On
    SendInput {Left}
    SetScrollLockState, Off
Return

+WheelDown::
    SetScrollLockState, On
    SendInput {Right}
    SetScrollLockState, Off
Return

; Horizontal scrolling in everything except Excel
+WheelDown::WheelRight
+WheelUp::WheelLeft

Also, you can achieve Mac hot corner-like functionality by combining AutoHotKey with the mouse. Refer to this article for details.

Scroll to Top