Vertical MouseMove to Wheel? Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Vertical MouseMove to Wheel?

Post by hemsith14_ » 17 Jul 2022, 22:33

Hey
I want to use a hotkey like !MButton + vertical mouse movement in order to send WheelUp that is related to the amount of movement.
Meaning: If the mouse has been moved a lot, send a lot of wheelup.
Being able to control this sensitivity would also be great.

Any help would be appreciated thank you

User avatar
neovis
Posts: 34
Joined: 12 Jun 2022, 03:56
Location: Republic of Korea
Contact:

Re: Vertical MouseMove to Wheel?  Topic is solved

Post by neovis » 18 Jul 2022, 01:40

Its useful idea to me. I made it in a simple way. I think it would be better if apply acceleration.

Code: Select all

!MButton::
current := 0
MouseGetPos,, y1
while (GetKeyState("MButton", "P")) {
    MouseGetPos,, y2
    offset := (y2-y1)//10 ; set scroll per pixel
    if (current != offset) {
        count := offset-current
        loop % Abs(count)
            Send % count > 0 ? "{WheelDown}" : "{WheelUp}"
        current := Offset
    }
    Sleep 10
}
return
And this is I will use horizontal scrolling added version.

Code: Select all

MButton::
currentX := currentY := 0
MouseGetPos x1, y1
while (GetKeyState("MButton", "P")) {
    MouseGetPos x2, y2
    offsetX := (x2-x1)//10
    offsetY := (y2-y1)//10
    if (currentX != offsetX) {
        count := offsetX-currentX
        loop % Abs(count)
            Send % count > 0 ? "{WheelRight}" : "{WheelLeft}"
        currentX := offsetX
    }
    if (currentY != offsetY) {
        count := offsetY-currentY
        loop % Abs(count)
            Send % count > 0 ? "{WheelDown}" : "{WheelUp}"
        currentY := offsetY
    }
    Sleep 10
}
return

hemsith14_
Posts: 296
Joined: 07 Nov 2020, 08:37

Re: Vertical MouseMove to Wheel?

Post by hemsith14_ » 18 Jul 2022, 09:13

Great stuff, thank you so much.

Post Reply

Return to “Ask for Help (v1)”