AutoHotkey Community

It is currently May 27th, 2012, 11:18 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2
Author Message
PostPosted: April 1st, 2009, 5:53 pm 
Offline

Joined: May 17th, 2008, 5:00 am
Posts: 39
Location: Dallas, TX
fsnow55 wrote:
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.


Sure. Mainly a matter of tweaking the acceleration factors (0.001, 5 and 2.0 below. 0.002, 5, 3.0 will produce more dramatic acceleration, 0.0005, 5, 1.5 will provide softer acceleration):
Code:
;Pseudo-code -- tweaking likely needed
myTicks := A_TickCount
if LastTicks
{
; Has it been less than a second since the last event?
  if ( ( myTicks - LastTicks ) < 1100 )
  {
; Calculate how many seconds have elapsed since the last wheel event. (ticks are in milliseconds)
    elapsed := ( myTicks - LastTicks ) * 0.001
; Raise the # of lines to a power (e.g. squared). More recent last event gets a higher power
    Lines: = 5 ^ ( 2.0 - elapsed )
; Send wheel event to OS
    MouseClick, WheelUp, , , %Lines%
}
LastTicks := myTicks


Enjoy,
Shawn


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 16 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: No registered users and 15 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group