Skip to content

Instantly share code, notes, and snippets.

@Robert-K
Last active March 15, 2025 11:16
Show Gist options
  • Save Robert-K/de73024ede628cb15f78273895217538 to your computer and use it in GitHub Desktop.
Save Robert-K/de73024ede628cb15f78273895217538 to your computer and use it in GitHub Desktop.
Map Horizontal Scroll to Windows Volume using AHK & Interception
#SingleInstance Force
#NoTrayIcon
Persistent
; You need to install the Interception driver & the AutoHotInterception library to use this script
; https://github.com/evilC/AutoHotInterception
#include <AutoHotInterception> ; Adjust the include if necessary
AHI := AutoHotInterception()
MX_HANDLE := "Find & copy your Mouse's handle here using the AHI Monitor Script"
Subscribe:
deviceList := AHI.GetDeviceList()
found := false
for i, device in deviceList {
if device.Handle = MX_HANDLE {
found := true
break
}
}
if !found {
Sleep 5000
goto Subscribe
}
mouseId := AHI.GetMouseIdFromHandle(MX_HANDLE)
AHI.SubscribeMouseButton(mouseId, 6, true, MouseButtonEvent)
MouseButtonEvent(state) {
if state == 1 {
; SoundSetVolume "-5"
Send "{Volume_Down}" ; Send makes the Windows volume slider pop up, SoundSetVolume doesn't
} else {
; SoundSetVolume "+5"
Send "{Volume_Up}"
}
}
@Robert-K
Copy link
Author

Robert-K commented Mar 12, 2025

I created this to replace the absolutely obnoxious and bloated Logi Options+ App. I only ever used it to control my PC's volume with the horizontal scroll wheel of my MX Master mouse.
This takes care of that.

You need to install the Interception driver & the AutoHotInterception library to use this script.

Should be easy to adjust this to your own usecase.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment