Control volume with mouse with pressed wheel

Get help with using AutoHotkey and its commands and hotkeys
metaxy
Posts: 2
Joined: 13 Apr 2020, 16:58

Control volume with mouse with pressed wheel

13 Apr 2020, 17:05

Hi!

I'm looking for a script to control volume by mouse wheel but only when it's pressed down.
User avatar
Scr1pter
Posts: 1200
Joined: 06 Aug 2017, 08:21
Location: Germany

Re: Control volume with mouse with pressed wheel

13 Apr 2020, 17:25

Hi and welcome,

Sounds a bit unorthodox (to use I mean).
Anyway, try this:

Code: Select all

~mbutton::
while GetKeyState("mbutton", "P") ; While mbutton is pressed:
{
  wheelMode = 1 ; Enable this wheelmode 
}
wheelMode = 0 ; Disable it
return

#if wheelMode = 1 ; Only if mbutton is pressed:
WheelUp::
Send {Volume_Up}
return

WheelDown::
Send {Volume_Down}
return
#if ; Close #if-Block
Don't break your finger :P

Cheers!
Please use [code][/code] when posting code!
Keyboard: Logitech G15 FE - Mice: Logitech G9 FE, G502 FE, G602, Jelly Comb Touchpad - OS: Windows 10 Pro 64 Bit - AHK version: 1.1.32.00
metaxy
Posts: 2
Joined: 13 Apr 2020, 16:58

Re: Control volume with mouse with pressed wheel

13 Apr 2020, 18:34

Thanks! Works like a charm! I'm really surprised how quick was your response and how helpful you are. I know that my "request" is little weird so quick explanation. I was looking for USB dongle to control volume. Simple small (like mouse BT dongle) potentiometer and couldn't find anything like that. I'm sleeping with notebook next to my bed on the coffee table 'cause I like to play some YT documentaries to sleep. And it's really annoying to open the lid, looking for volume control etc. when you're trying to fall asleep. This way I can do it without opening eyes. Yeah, I know, first world problems.

Return to “Ask For Help”

Who is online

Users browsing this forum: Bing [Bot], blad4, Chunjee, DyaTactic, Google [Bot], mikeyww and 42 guests