forward & back mouse buttons for volume problem Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

forward & back mouse buttons for volume problem

03 Mar 2021, 15:17

Hello, like the title says I'm trying to replace the two extra mouse buttons (browser forward and back) to control the volume.
I have this:

Code: Select all

XButton1::Send {Volume_Down}
XButton2::Send {Volume_Up}
return
It works but I can't long press these buttons, only single presses. Can anyone help? I'm sure it must be something simple but I can't figure it out.
Cheers.
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: forward & back mouse buttons for volume problem

03 Mar 2021, 18:12

Code: Select all

XButton1::
While GetKeyState(A_ThisHotkey, "P") {
 Send {Volume_Down}
 SoundBeep, 1500, 30
 Sleep, 50
}
Return
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: forward & back mouse buttons for volume problem

04 Mar 2021, 08:49

mikeyww wrote:
03 Mar 2021, 18:12

Code: Select all

XButton1::
While GetKeyState(A_ThisHotkey, "P") {
 Send {Volume_Down}
 SoundBeep, 1500, 30
 Sleep, 50
}
Return
This works, thanks but it behaves in a strange manner, not like the default volume up and down keys. Is there a way to make it work as default? (speed, acceleration and increments)
User avatar
mikeyww
Posts: 27372
Joined: 09 Sep 2014, 18:38

Re: forward & back mouse buttons for volume problem

04 Mar 2021, 08:59

You would have to program that into your script. The A_TimeSince... built-in variables can help you determine what acceleration factor you need. You can then adjust the sleep accordingly. If you need different increments, you can send the key more than once. You build whatever rules you want for the increments & acceleration.
sulphuricsaliva
Posts: 48
Joined: 11 Sep 2018, 12:37

Re: forward & back mouse buttons for volume problem  Topic is solved

04 Mar 2021, 15:34

mikeyww wrote:
04 Mar 2021, 08:59
You would have to program that into your script. The A_TimeSince... built-in variables can help you determine what acceleration factor you need. You can then adjust the sleep accordingly. If you need different increments, you can send the key more than once. You build whatever rules you want for the increments & acceleration.
It's not absolutely perfect, but It's pretty close. Thank you so much for your help.
Cheers, be safe.

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Google [Bot], Hugh Jars, Mateusz53, MrDoge, peter_ahk and 367 guests