Adjust Windows Volume Using AutoHotkey

📅 May 20, 2021
productivity - technology


One of my favorite programs on Windows is AutoHotkey. AutoHotkey allows you to write custom scripts and bind them to key combinations or mouse actions.

One of my favorite scripts is adjusting the volume using the mouse scroll wheel when hovering over the taskbar. You can accomplish that with the script below.

;--------------------------------------------------------------------
; Change volume using mouse scroll wheel over taskbar
;--------------------------------------------------------------------

#if MouseIsOver("ahk_class Shell_TrayWnd") || MouseIsOver("ahk_class Shell_SecondaryTrayWnd")

WheelUp::
Send {Volume_Up}
return

WheelDown::
Send {Volume_Down}
return

MouseIsOver(WinTitle) 
{
    MouseGetPos,,, Win
    return WinExist(WinTitle . " ahk_id " . Win)
}