AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mouse wheel speed
Goto page 1, 2  Next
 
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Wed Apr 12, 2006 3:38 pm    Post subject: Mouse wheel speed Reply with quote

Does anyone know how to set the scrolling speed of the mouse wheel from AHK? TweakUI allows setting it, but at the next boot it gets back to the default 3 lines at a time.

Also, even though I set 1 line scrolling at a time, many applications scroll 3 lines, anyway. MS Word and MSIE honors the TweakUI setting, others ignore it. Is there a more general way of setting the scroll speed, than what TweakUI uses? The following does not seem to have any effect
Code:
RegWrite REG_SZ, HKEY_CURRENT_USER, Control Panel\Desktop, WheelScrollLines, 1
RegWrite REG_SZ, HKEY_USERS, .DEFAULT\Control Panel\Desktop, WheelScrollLines, 1
Back to top
View user's profile Send private message
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Wed Apr 12, 2006 4:49 pm    Post subject: Reply with quote

I played around with it a little while back. I noticed that notepad seems to ignore the scroll wheel settings and always scrolls 3 lines, so probably some programs handle the number of lines to scroll themselves.

Code:

; retrieve original scroll wheel setting
; #define SPI_GETWHEELSCROLLLINES    0x68
DllCall("SystemParametersInfo", UInt, 0x68, UInt, 0, UIntP, Scroll_Lines, UInt, 0)


; set new value
; #define SPI_SETWHEELSCROLLLINES    0x69
Scroll_Lines_Accel := 6
DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines_Accel, UInt, 0, UInt, 0)




I've been messing around to accelerate the scroll wheel with the new A_EventInfo for the wheel too (works quite well along with KatMouse):

Code:

; #define SPI_GETWHEELSCROLLLINES    0x68
; #define SPI_SETWHEELSCROLLLINES    0x69

SetMouseDelay, -1
DllCall("SystemParametersInfo", UInt, 0x68, UInt, 0, UIntP, Scroll_Lines, UInt, 0)
OnExit, Clean_Up
return

WheelUp::
  Critical
  If A_EventInfo =1
    Scroll_Lines_Accel := Scroll_Lines
  Else If  A_EventInfo =2
    Scroll_Lines_Accel := Scroll_Lines * A_EventInfo * A_EventInfo
  Else If  A_EventInfo >2
    Scroll_Lines_Accel := Scroll_Lines * A_EventInfo * A_EventInfo * A_EventInfo
  DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines_Accel, UInt, 0, UInt, 0)
  Send, {WheelUp}
return

WheelDown::
  Critical
  If A_EventInfo =1
    Scroll_Lines_Accel := Scroll_Lines
  Else If  A_EventInfo =2
    Scroll_Lines_Accel := Scroll_Lines * A_EventInfo * A_EventInfo
  Else If  A_EventInfo >2
    Scroll_Lines_Accel := Scroll_Lines * A_EventInfo * A_EventInfo * A_EventInfo
  DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines_Accel, UInt, 0, UInt, 0)
  Send, {WheelDown}
return



Clean_Up:
  DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines, UInt, 0, UInt, 0)
  Exitapp
Back to top
View user's profile Send private message
garath



Joined: 24 Mar 2005
Posts: 398
Location: germany

PostPosted: Wed Apr 12, 2006 4:50 pm    Post subject: Reply with quote

Öhm, that sounds easy, you want to use AHK to change Mouse-wheel speed?
Code:
Speed = 5     ;Enter here the lines to move up or dow, if wheel is turned

WheelUp::MouseClick, WheelUp, , , %Speed%
WheelDown::MouseClick, WheelDown, , , %Speed%
Back to top
View user's profile Send private message
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Wed Apr 12, 2006 4:57 pm    Post subject: Reply with quote

@ garath:
I'd overlooked that one, but it's not quite the same:
Quote:
ClickCount is the number of notches to turn the wheel
- so it will be a multiple of the number of lines the wheel is set to scroll.
Back to top
View user's profile Send private message
garath



Joined: 24 Mar 2005
Posts: 398
Location: germany

PostPosted: Wed Apr 12, 2006 5:09 pm    Post subject: Reply with quote

@evl
Hmm, you are right, it would only speed up movement, so DLLcalls seem to be the only way to solve this problem.
Sadly, I am not DLL-proof Crying or Very sad
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Wed Apr 12, 2006 5:51 pm    Post subject: Reply with quote

Thanks, evl! The dll call seem to have the same effects as TweakUI.
evl wrote:
Code:
DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines_Accel, UInt, 0, UInt, 0)
Now I can set 1-line scrolling in my start-up script.

I found that Windows handles the acceleration pretty well, I don't have to change the scrolling speed. In Control Panel / Mouse I set what I want, and Windows changes temporarily the scrolling lines, if many wheel events are received in a short time.
Back to top
View user's profile Send private message
evl



Joined: 24 Aug 2005
Posts: 1237

PostPosted: Wed Apr 12, 2006 6:09 pm    Post subject: Reply with quote

Quote:
and Windows changes temporarily the scrolling lines, if many wheel events are received in a short time
- are you sure it's doing that? As far as I'm aware Windows doesn't change the wheel lines setting itself or accelerate in any way (it just reacts to the number of wheel events - certainly seems to be the case with the default of 3 lines per scroll). Maybe you are running some software/drivers from the mouse's manufacturer that do this?
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Wed Apr 12, 2006 6:20 pm    Post subject: Reply with quote

You're right, I use MS IntelliPoint 5.2, which came with my Bluetooth keyboard/mouse combo. The acceleration settings are in there (or in the mouse driver - you cannot tell them appart), I just assumed it was a Windows feature. But it accelerates really well. You could give it a try...
Back to top
View user's profile Send private message
überRegenbogen



Joined: 20 Dec 2006
Posts: 1

PostPosted: Wed Dec 20, 2006 11:24 am    Post subject: Mouse wheel accelleration Reply with quote

garath wrote:
Öhm, that sounds easy, you want to use AHK to change Mouse-wheel speed?
Code:
Speed = 5  ;lines to [scroll]
WheelUp::MouseClick, WheelUp, , , %Speed%
WheelDown::MouseClick, WheelDown, , , %Speed%


Holy freakin thank you! I had hitherto been using a horridly clunky piece of scriptage, which was not capable of much accelleration—apparently due to limited responsiveness:
Code:

$WheelUp::
$WheelDown::%A_TimeSincePriorHotkey% %A_ThisHotkey% %B_ThisHotkey%
    StringReplace, B_ThisHotkey, A_ThisHotkey, $,
    sendinput {%B_ThisHotkey%}
    if A_PriorHotkey = %A_ThisHotkey%
        if A_TimeSincePriorHotkey < 70
            sendinput {%B_ThisHotkey%}{%B_ThisHotkey%}
return


I'd glanced at MouseClick, but it hadn't sunk in how to use it. Now, thanks to your sample, i have a new blob, which performs on par with the acceleration that IntelliPoint had been providing, before i (prompted by a need to upgrade to 5, to support a USB mouse) decided to get its bloated, home-phoning hide the beep out of my computer.
Code:

$WheelUp::
$WheelDown::
    StringReplace B_ThisHotkey, A_ThisHotkey, $,
    B_WheelStep = 1
    if A_PriorHotkey = %A_ThisHotkey%
        if A_TimeSincePriorHotkey < 70
            B_WheelStep = 3
    MouseClick %B_ThisHotkey%,,,%B_WheelStep%
return


(I'll may add another level of accelleration, later. But for now, this kicks!)

[Side note: I'm using nested if because and was totally not working. (1.0.44.12)]
_________________
Irgendwo über dem Regenbogen
Back to top
View user's profile Send private message
Laszlo



Joined: 14 Feb 2005
Posts: 4710
Location: Boulder, CO

PostPosted: Wed Dec 20, 2006 2:00 pm    Post subject: Re: Mouse wheel accelleration Reply with quote

überRegenbogen wrote:
I'm using nested if because and was totally not working. (1.0.44.12)]
It works for me. Have you forgotten the parentheses? Try this
Code:
WheelUp::
WheelDown::
    if (A_PriorHotkey = A_ThisHotkey and A_TimeSincePriorHotkey < 70)
         MouseClick %A_ThisHotkey%,,,3
    else MouseClick %A_ThisHotkey%
return
Back to top
View user's profile Send private message
Guest






PostPosted: Thu Dec 21, 2006 6:54 am    Post subject: Re: Mouse wheel accelleration Reply with quote

Ah ha! I'd managed to get confused about if var vs if (expression). I think i tried it once, but put the %% around the var name. Crazy crazy syntax this thing has--but one hell of a capable tool!

I see that you whitled yet more fat out of my blob. Cool! I didn't think far enough to realize that i didn't need the $ prefix anymore. Smile (The B_WheelStep variable was in thinking toward a more sophisticated accelleration curve, but that can wait.)
Back to top
tinaa



Joined: 25 Nov 2004
Posts: 57

PostPosted: Mon Jul 14, 2008 10:50 pm    Post subject: Reply with quote

Laszlo wrote:
Thanks, evl! The dll call seem to have the same effects as TweakUI.
evl wrote:
Code:
DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines_Accel, UInt, 0, UInt, 0)
Now I can set 1-line scrolling in my start-up script.

I found that Windows handles the acceleration pretty well, I don't have to change the scrolling speed. In Control Panel / Mouse I set what I want, and Windows changes temporarily the scrolling lines, if many wheel events are received in a short time.


I realize I'm resurrecting an old thread, but I'm trying to solve the problem of my laptop's touchpad scrolling being too sensitive compared to the scrollwheel on my bluetooth mouse so I need to change the scrollwheel speed from 1 to 3 depending on which I'm using. Ideally, it would be nice for this to occur automatically, but I don't mind launching a script manually. I've tried the above suggestion and it works

However, it seems most applications don't see the change unless they are closed and restarted, which can be a pain. Is there any way to force the change to occur immediately?

Thanks!
Back to top
View user's profile Send private message
Gertlex



Joined: 29 Oct 2006
Posts: 39
Location: A2 MI

PostPosted: Fri Aug 15, 2008 7:35 pm    Post subject: Reply with quote

tinaa wrote:
Laszlo wrote:
Thanks, evl! The dll call seem to have the same effects as TweakUI.
evl wrote:
Code:
DllCall("SystemParametersInfo", UInt, 0x69, UInt, Scroll_Lines_Accel, UInt, 0, UInt, 0)
Now I can set 1-line scrolling in my start-up script.

I found that Windows handles the acceleration pretty well, I don't have to change the scrolling speed. In Control Panel / Mouse I set what I want, and Windows changes temporarily the scrolling lines, if many wheel events are received in a short time.


I realize I'm resurrecting an old thread, but I'm trying to solve the problem of my laptop's touchpad scrolling being too sensitive compared to the scrollwheel on my bluetooth mouse so I need to change the scrollwheel speed from 1 to 3 depending on which I'm using. Ideally, it would be nice for this to occur automatically, but I don't mind launching a script manually. I've tried the above suggestion and it works

However, it seems most applications don't see the change unless they are closed and restarted, which can be a pain. Is there any way to force the change to occur immediately?

Thanks!


Maybe set the default to 1 line and multiply by 3 when needed? I think that might get around the app restarts necessitated by bluetooth.
Back to top
View user's profile Send private message AIM Address
TheLeO



Joined: 11 Jun 2005
Posts: 264
Location: England ish

PostPosted: Sat Sep 06, 2008 7:49 pm    Post subject: Reply with quote

good idea.
_________________
::
I Have Spoken
::
Back to top
View user's profile Send private message Visit poster's website MSN Messenger
fsnow55



Joined: 08 Jun 2006
Posts: 36

PostPosted: Mon Mar 30, 2009 9:19 pm    Post subject: Adding momentum to scroll wheel Reply with quote

Is it possible to add momentum to the scroll wheel? ie.. if I'm scrolling
slowly with the wheel, the speed should be about what evl's script produced (scrolling lines quickly); if I'm moving the wheel quickly, it should fly through and be scrolling by pages.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Goto page 1, 2  Next
Page 1 of 2

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group