HoverScroll and Microsoft Edge

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
0xDEADC0DE
Posts: 10
Joined: 14 Jan 2016, 10:31

HoverScroll and Microsoft Edge

14 Jan 2016, 10:39

I'm using HoverScroll https://autohotkey.com/board/topic/9940 ... ion/page-6 since some years and it works perfectly. But since Windows 10 and Microsoft Edge, I'm not able to scroll in Edge. I have to disable AutoHotkey to get it working.
I have tried all the various options for alternative modes in HoverScroll but it doesn't work for me.
Anybody else having this problem and who has fixed this already?
User avatar
Scoox
Posts: 125
Joined: 11 May 2014, 09:12
Location: China

Re: HoverScroll and Microsoft Edge

04 Jun 2017, 10:23

Hi, I'm the original author of HoverScroll() and I've recently upgraded to Windows 10. This problem is not limited to Edge, but in fact to all UWP (Universal Windows Platform) applications. That means Edge, Settings, Photos, etc, all won't respond to HoverScroll(). I put up with this problem for a while but today I thought it was time to find a solution. Good news is: I have found a solution that actually works great, and actually even better than the old version!

I will post it here on ahkscrip.org soon. I will post the link here so that you can check it out.
iPhilip
Posts: 822
Joined: 02 Oct 2013, 12:21

Re: HoverScroll and Microsoft Edge

08 Aug 2017, 05:38

Hi Scoox,

Do you have the updated version of HoverScroll() mentioned above? If it's not ready could you post the original version here or under the functions section? The original link to the HoverScroll v1.04.zip file is no longer working.

Thank you,

iPhilip
Windows 10 Pro (64 bit) - AutoHotkey v2.0+ (Unicode 64-bit)
0xDEADC0DE
Posts: 10
Joined: 14 Jan 2016, 10:31

Re: HoverScroll and Microsoft Edge

09 Jan 2018, 19:16

Hello Scoox. Can you post the new working version?
Amunoto
Posts: 15
Joined: 01 Dec 2018, 08:31

Re: HoverScroll and Microsoft Edge

11 Dec 2019, 07:44

Hello Scoox
Seems like you have invested quite some time into this script – And made it a great tool, according to the posts in the two threats I have read!
I would love to try it, as I am searching for a mouse accelaration tool, too.
Could you please post the code into the forum?
Kind regards from Switzerland, Hauke
User avatar
boiler
Posts: 17042
Joined: 21 Dec 2014, 02:44

Re: HoverScroll and Microsoft Edge

11 Dec 2019, 09:07

Amunoto wrote:
11 Dec 2019, 07:44
I am searching for a mouse accelaration tool, too.
GGGlide is more of a mouse pointer momentum tool rather than acceleration tool, but it's great for touchpads.
Amunoto
Posts: 15
Joined: 01 Dec 2018, 08:31

Re: HoverScroll and Microsoft Edge

04 Feb 2020, 11:31

Thank you, Boiler. But what I am interested in, is for use with the mouse. Kind regards, Hauke
poiuz
Posts: 2
Joined: 12 Aug 2020, 09:30

Re: HoverScroll and Microsoft Edge

12 Aug 2020, 10:06

I found HoverScroll 1.04 on GitHub and attached it as zip file:
HoverScroll 1.4.ahk.zip
(4.51 KiB) Downloaded 75 times
You can get more information about the script on the old archive AutoHotkey board.
Amunoto
Posts: 15
Joined: 01 Dec 2018, 08:31

Re: HoverScroll and Microsoft Edge

12 Aug 2020, 14:15

Thank you very much for posting this source, here!
Aqualest
Posts: 2
Joined: 02 May 2024, 21:32

Re: HoverScroll and Microsoft Edge

Yesterday, 17:29

If anyone has an exe file of HoverScroll() 1.04, please upload it.

Because all the ahk files I found by Googling don't work.
gregster
Posts: 9048
Joined: 30 Sep 2013, 06:48

Re: HoverScroll and Microsoft Edge

Yesterday, 17:38

Aqualest wrote:
Yesterday, 17:29
If anyone has an exe file of HoverScroll() 1.04, please upload it.

Because all the ahk files I found by Googling don't work.
The uncompiled v1 script HoverScroll 1.04 can be downloaded from poiuz's post above.

If it works, you could easily compile it with the ahk2exe compiler - included with AHK v1.

If it will work on recent Windows versions, I don't know. Looking at the thread above, there seems to be some conflict with UWP apps...
Aqualest
Posts: 2
Joined: 02 May 2024, 21:32

Re: HoverScroll and Microsoft Edge

Yesterday, 17:42

If anyone has an exe file of HoverScroll() 1.04, please upload it here. I lost the exe file due to false detection of anti-virus. The files in the above post and all the ahk files I found by Googling are not working. so please help.
User avatar
V0RT3X
Posts: 238
Joined: 20 May 2023, 21:59
Contact:

Re: HoverScroll and Microsoft Edge

Today, 08:01

Probably a silly question, but do you actually have AutoHotkey installed? You need that to run .ahk files.
Once installed, you can compile your .ahk script into an .exe using ahk2exe that comes with the AutoHotkey installation as noted by Gregster, that you can run on any computer without the need to have Autotkey installed.
However, as also noted by Gregster there may be conflict issues.
The link from poiuz's post gives me the 404 page not found error, so you may also have to hunt another source.
Happy Hunting!!
gregster
Posts: 9048
Joined: 30 Sep 2013, 06:48

Re: HoverScroll and Microsoft Edge

22 minutes ago

V0RT3X wrote:
Today, 08:01
The link from poiuz's post gives me the 404 page not found error, so you may also have to hunt another source.
Only the github link is dead - the attached link below it, which links to a zip-file on our website, works however. (Right above the line which says '(4.51 KiB) 'Downloaded 74 times' or similar.)
This is a link to the same file: download/file.php?mode=view&id=10308

Anyway, here is the contained code:

Code: Select all

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; HoverScroll() v1.04
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
;© 2014 Scoox
;Send scroll messages to any control without focus
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;** INCLUDE THIS FILE IN AUTUEXECUTE SECTION OF MAIN SCRIPT **

;Specify this in calling script
;#MaxHotkeysPerInterval 500 ;Avoid warning when mouse wheel turned very fast

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Constants
HoverScrollMinLines := 1 ;lines per notch
HoverScrollMaxLines := 5 ;lines per notch
HoverScrollThreshold := 70 ;Max Miliseconds between two consecutive notches (user defined)
HoverScrollCurve := 0 ;Acceleration curve: 0 = Straight line (default), 1 = Parabola

;Determine system frequency in Hz:
DllCall("QueryPerformanceFrequency", "Int64 *", Frequency)

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Application exceptions

;NOTE: By default this script will use the target control HWND obtained via DLL call ast this method works in the most places. To use a different method, add to the corresponding group below.

;NOTE: The same window can be added to several different groups
;NOTE: RegEx is allowed in group definitions e.g. "ahk_class Note.?ad" etc
;NOTE: This script assumes that the same method will work with all controls of a given application. Should this limitation be a problem, flexible per-control support may be added in the future.

;Methods:
	;GroupAdd, HoverScroll_Hwnd
	;GroupAdd, HoverScroll_HwndClassNN
	;GroupAdd, HoverScroll_Window ;Post messages to whole window instead of control under mouse
	;GroupAdd, HoverScroll_HwndDll ;Default method (no need to explicitly add to this group)

GroupAdd, HoverScroll_Hwnd, Fireface Settings ahk_class #32770 ;RME Fireface settings

;Workarounds:
	;GroupAdd, HoverScroll_Loop ;Use this when unable to scroll more than one line per notch
	;GroupAdd, HoverScroll_FocusControl ;Use this for apps that refuse to scroll
	;GroupAdd, HoverScroll_HScrollAlternative ;Try this for apps that don't respond to standard HORIZONTAL scroll method

GroupAdd, HoverScroll_Loop, ahk_class TEventEditForm ;FL Studio arranger view
GroupAdd, HoverScroll_Loop, ahk_class TFruityLoopsMainForm ;FL Studio arranger view
GroupAdd, HoverScroll_Loop, ahk_class CCLWindowClass ;Studio One main window
GroupAdd, HoverScroll_Loop, ahk_class CCLShadowWindowClass ;Studio One mixer and plugins
GroupAdd, HoverScroll_Loop, Traktor ahk_class NINormalWindow00400000 ;NI Traktor faders, knobs, etc

GroupAdd, HoverScroll_FocusControl, ahk_class TFruityLoopsMainForm
GroupAdd, HoverScroll_FocusControl, ahk_class TProjectPropertiesForm

GroupAdd, HoverScroll_HScrollAlternative, ahk_class MSPaintApp
GroupAdd, HoverScroll_HScrollAlternative, ahk_class classFoxitReader
GroupAdd, HoverScroll_HScrollAlternative, ahk_classDSUI:PDFXCViewer
GroupAdd, HoverScroll_HScrollAlternative, Microsoft Visio ahk_class VISIOA

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;MS Office applications
Global HoverScroll_ControlExceptions_MSOffice
HoverScroll_ControlExceptions_MSOffice .= "EXCEL71" ;Excel
HoverScroll_ControlExceptions_MSOffice .= "|_WwG1" ;Word
HoverScroll_ControlExceptions_MSOffice .= "|paneClassDC1" ;PowerPoint
HoverScroll_ControlExceptions_MSOffice .= "|NetUIHWND1" ;Access
;HoverScroll_ControlExceptions_MSOffice .= ... add your own here e.g. Access etc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; HoverScroll()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/*
Lines:
Optional paramter, default value = 1.

Axis:
1 = Vertical scrolling (default if omitted)
0 (or any value other than 1) = Horizontal scrolling

Ctrl:
1 = Send Ctrl-Wheel
Else (default) = Normal scrolling

Shift:
1 - Send Shift-Wheel
Else (default) = Normal scrolling

Optional parameter, default value = 1.
The number of lines to scroll per scrollwheel notch. Negative values scroll downwards. If omitted this parameter a value of 1 will be used.

Return value:
None.
*/

HoverScroll(Lines=1, Axis=1, Ctrl=0, Shift=0)
{
	Critical
	SetTitleMatchMode RegEx
	CoordMode, Mouse, Screen ;All coords relative to screen
	SetBatchLines, -1 ;Run as fast as possible
	SetMouseDelay, -1
	SetControlDelay, 0

	MouseGetPos, m_x, m_y, WinID, ControlClassNN, 1
	MouseGetPos,,,, ControlHwnd, 2

	;ControlHwndDll := DllCall("WindowFromPoint", "int", m_x, "int", m_y) ;32-bit only (bad)
	ControlHwndDll := DllCall( "WindowFromPoint", "int64", (m_y << 32) | (m_x & 0xFFFFFFFF), "Ptr") ;both 64 and 32-bit (good)

	;Some applications require that the target control has input focus.
	;This won't necessarily activate the window containing the target control, e.g. FL Studio
	IfWinExist ahk_id %WinID% ahk_group HoverScroll_FocusControl
	{
		ControlFocus,, ahk_id %ControlHwnd%
		ControlFocus,, ahk_id %ControlHwndDll%
	}

	;Horizontal scrolling work-around using WM_HSCROLL = 0x114
	;This method gives you less control than using WM_MOUSEHWHEEL,
	;but may work in some apps where WM_MOUSEHWHEEL does not.
	If (Axis != 1) ;If horizontal scrolling
	{
		IfWinExist ahk_id %WinID% ahk_group HoverScroll_HScrollAlternative
		{
			Iterations := Abs(Lines)
			If (Lines < 0)
				Loop %Iterations%
					PostMessage, 0x114, 0, 0,, ahk_id %ControlHwnd%
			Else
				Loop %Iterations%
					PostMessage, 0x114, 1, 0,, ahk_id %ControlHwnd%
			Return
		}

		;Microsoft office applications using Office VBA's SmallScroll method
		If (ControlClassNN ~= HoverScroll_ControlExceptions_MSOffice)
		{
			Try ;Avoid weird error if MButton pressed accidentally
			{
				;Include Acc.ahk in calling script
				;See Post #6 by user "jethrow" on the following thread:
				;http://www.autohotkey.com/board/topic/35292-horizontal-scroll-in-excel-2007/

				;SmallScroll method information
				;http://msdn.microsoft.com/en-us/library/office/aa166801%28v=office.10%29.aspx
				;If Lines < 0
				;	Acc_ObjectFromWindow(ControlHwndDll, -16).SmallScroll(0,0,0,Abs(Lines))
				;Else
				;	Acc_ObjectFromWindow(ControlHwndDll, -16).SmallScroll(0,0,Abs(Lines),0)
			}
			Return
		}
	}

	;lParam := (m_y << 16) | m_x ;Does not work with -ve coords when using more than one display
	lParam := (m_y << 16) | (m_x & 0x0000FFFF) ;Works with -ve coords (recommended)

	wParam := (120 << 16) * (Lines < 0 ? -1 : 1)
	wParam |= Ctrl ? 8 : 0
	wParam |= Shift ? 4 : 0

	;All of the following available focusless scrolling methods were tested.
	;The one marked as "BEST" was found to work on the most number of control, and so was chosen as the default method.

	;SendMessage, %Axis%, wParam, lParam, %ControlClassNN%, ahk_id %WinID%
	;SendMessage, %Axis%, wParam, lParam,, ahk_id %ControlHwndDll%
	;SendMessage, %Axis%, wParam, lParam,, ahk_id %ControlHwnd%
	;PostMessage, %Axis%, wParam, lParam, %ControlClassNN%, ahk_id %WinID%
	;PostMessage, %Axis%, wParam, lParam,, ahk_id %ControlHwndDll% ;** BEST **
	;PostMessage, %Axis%, wParam, lParam,, ahk_id %ControlHwnd%
	
	;Looping to send repeated wheel events is slower but works everywhere.
	;(wParam * Lines) does not work in a few programs, in which case Loop should be used.
	Lines := Abs(Lines)
	Iterations := 1
	IfWinExist ahk_id %WinID% ahk_group HoverScroll_Loop
	{
		Iterations := Lines
		Lines := 1
	}

	;WM_MOUSEWHEEL = 0x20A
	;WM_MOUSEHWHEEL = 0x20E
	If (Axis = 1)
		Message := 0x20A ;vertical scroll
	Else	
		Message := 0x20E ;horizontal scroll


	IfWinExist ahk_id %WinID% ahk_group HoverScroll_ClassNN
		Loop %Iterations%
			PostMessage, %Message%, wParam * Lines, lParam, %ControlClassNN%, ahk_id %WinID%	
	Else IfWinExist ahk_id %WinID% ahk_group HoverScroll_Hwnd
		Loop %Iterations%
			PostMessage, %Message%, wParam * Lines, lParam,, ahk_id %ControlHwnd%
	Else IfWinExist ahk_id %WinID% ahk_group HoverScroll_Window
		Loop %Iterations%
			PostMessage, %Message%, wParam * Lines, lParam,, ahk_id %WinID%
	Else
		Loop %Iterations%
			PostMessage, %Message%, wParam * Lines, lParam,, ahk_id %ControlHwndDll%
}


;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
; ScrollLines()
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

/*
MinLines:
Optional paramter, default value = 1.
Minimum number of lines to scroll per notch (typically you'll want this set to 1)

MaxLines:
Optional paramter, default value = 5.
Maximum number of lines to scroll per notch.

Threshold:
Optional paramter, default value = 20.
The higher this value, the easier it is to engage acceleration.
This is a value in milliseconds that represents the time between scrollwheel notches. Acceleration kicks in when the scrollwheel is turned fast enough so that the time between notches is LESS than this value. If the time between notches is GREATER than this value, acceleration is disengaged and the functionr eturns MinLines.

Curve:
Optional paramter, default value = 0 (linear).
Two flavours of of acceleration curve are provided (feel free to add your own). Each curve has a different feel, try and choose the one that you feel more comfortable with.
0 = Straight line
1 = Parabola

;Parameter value ranges (parameters set to values outside will produce undefined behaviour):
	;1 <= MinLines <= MaxLines (MinLines = MaxLines disables acceleration)
	;Threshold can be any positive number. With invalid values the function returns MaxLines.
	;Curve can be 0 or 1, other values default to 0

Return value:
Returns the number of lines to scroll calculated from current scrollwheel angular speed.
*/

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Standard method (A_TimeSincePriorHotkey), no interpolation
;Simplest and most direct method, but perhaps not the most accurate.
ScrollLines_1(MinLines=1, MaxLines=5, Threshold=50, Curve=0)
{
	Static MinInterval := 20 ;MinInterval value calculated automatically afterwards

	;If changing scroll direction, assume lowest scroll speed
	If (A_ThisHotkey != A_PriorHotkey)
		Return MinLines

	T := A_TimeSincePriorHotkey
	;Record new shortest interval
	If (T < MinInterval)
		MinInterval := T

	;Shift stored times on
	Loop % Times.MaxIndex() - 1
		Times[A_Index] := Times[A_Index + 1]

	If (T > Threshold) ;Normal slow scrolling or changing scroll direction
		Lines := MinLines
	Else If(T < MinInterval Or Threshold < MinInterval) ;Fastest scrolling allowed
		Lines := MaxLines
	Else ;Scrolling speeds in between
	{
		If (Curve = 1)
		{
			;f(t) = At^2 + Bt + C
			A := (MaxLines - MinLines) / ((MinInterval - Threshold)**2)
			B := -2 * A * Threshold
			C := MinLines - (A * Threshold**2) - (B * Threshold)
			;C := MaxLines - (A * MinInterval**2) - (B * MinInterval) ;or this
			Lines := Round(A * T**2 + B * T + C)
		}
		Else ;Default curve is straigth line
		{
			;f(t) = At + B
			A := (MaxLines - MinLines) / (MinInterval - Threshold)
			B := MaxLines - (A * MinInterval)
			Lines := Round(A * T + B)
		}
	}
	Return Lines
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;Standard method (A_TickCount) with linear interpolation
;Increased accuracy over previous method, however it requires more notches to calculate return value.
ScrollLines_2(MinLines=1, MaxLines=5, Threshold=50, Curve=0)
{
	;Increase number of items of Times array to reduce the effect of timing errors.
	;Each item in this array represents one notch of the scrollwheel. An array with 5 items means that this function will use the time difference between the 5th and the 1st notches in order to calculate the number of lines to scroll. Therefore you first need to turn the wheel 5 times before acceleration kicks in.
	;Therefore it follows that if you are only able to scroll through a maximum of, say, 12 notches per scrollwheel stroke (due to physical limitations of your mouse), then using an array with 12 or more items means that acceleration will never be engaged.
	;The "delay" introduced by this mechanism may also help remove spurious unintended scrollwheel speed spikes.
	;Array must have a minimum of 2 items (undefined behaviour otherwise).
	;Recommended number of items: 2 to 5 (determined empirically).
	;Using only 2 items is equivalent to using A_TimeSincePriorHotkey
	Static Times := [0,0,0,0,0]
	Static MinInterval := 20 ;MinInterval value calculated automatically afterwards

	;If changing scroll direction, assume lowest scroll speed
	If (A_ThisHotkey != A_PriorHotkey)
		Return MinLines

	Times[Times.MaxIndex()] := A_TickCount
	T := (Times[Times.MaxIndex()] - Times[1]) / (Times.MaxIndex() - 1)

	;Record new shortest interval
	If (T < MinInterval)
		MinInterval := T
	
	;Shift stored times on
	Loop % Times.MaxIndex() - 1
		Times[A_Index] := Times[A_Index + 1]

	If (T > Threshold) ;Normal slow scrolling or changing scroll direction
		Lines := MinLines
	Else If(T < MinInterval Or Threshold < MinInterval) ;Fastest scrolling allowed
		Lines := MaxLines
	Else ;Scrolling speeds in between
	{
		If (Curve = 1)
		{
			;f(t) = At^2 + Bt + C
			A := (MaxLines - MinLines) / ((MinInterval - Threshold)**2)
			B := -2 * A * Threshold
			C := MinLines - (A * Threshold**2) - (B * Threshold)
			;C := MaxLines - (A * MinInterval**2) - (B * MinInterval) ;or this
			Lines := Round(A * T**2 + B * T + C)
		}
		Else ;Default curve is straigth line
		{
			;f(t) = At + B
			A := (MaxLines - MinLines) / (MinInterval - Threshold)
			B := MaxLines - (A * MinInterval)
			Lines := Round(A * T + B)
		}
	}
	Return Lines
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

;QPC method with linear interpolation (high precision)
;Most accurate method, same as previous method but using QueryPerformanceCounter call.
;Global Frequency variable to be initialized outside the function in auto-execute section (can be set within the function but that would be wasteful).
ScrollLines_3(MinLines=1, MaxLines=5, Threshold=50, Curve=0)
{
	;Increase number of items of Times array to reduce the effect of timing errors.
	;Each item in this array represents one notch of the scrollwheel. An array with 5 items means that this function will use the time difference between the 5th and the 1st notches in order to calculate the number of lines to scroll. Therefore you first need to turn the wheel 5 times before acceleration kicks in.
	;Therefore it follows that if you are only able to scroll through a maximum of, say, 12 notches per scrollwheel stroke (due to physical limitations of your mouse), then using an array with 12 or more items means that acceleration will never be engaged.
	;The "delay" introduced by this mechanism may also help remove spurious unintended scrollwheel speed spikes.
	;Array must have a minimum of 2 items (undefined behaviour otherwise).
	;Recommended number of items: 2 to 5 (determined empirically).
	Static Times := [0,0,0,0,0]
	Static MinInterval := 20 ;MinInterval value calculated automatically afterwards
	Global Frequency

	;If changing scroll direction, assume lowest scroll speed
	If (A_ThisHotkey != A_PriorHotkey)
		Return MinLines

	DllCall("QueryPerformanceCounter", "Int64 *", Value)
	Times[Times.MaxIndex()] := Value
	T := (Times[Times.MaxIndex()] - Times[1]) / (Times.MaxIndex() - 1) * 1000 / Frequency

	;Record new shortest interval
	If (T < MinInterval)
		MinInterval := T
	
	;Shift stored times on
	Loop % Times.MaxIndex() - 1
		Times[A_Index] := Times[A_Index + 1]

	If (T > Threshold) ;Normal slow scrolling or changing scroll direction
		Lines := MinLines
	Else If(T < MinInterval Or Threshold < MinInterval) ;Fastest scrolling allowed
		Lines := MaxLines
	Else ;Scrolling speeds in between
	{
		If (Curve = 1)
		{
			;f(t) = At^2 + Bt + C
			A := (MaxLines - MinLines) / ((MinInterval - Threshold)**2)
			B := -2 * A * Threshold
			C := MinLines - (A * Threshold**2) - (B * Threshold)
			;C := MaxLines - (A * MinInterval**2) - (B * MinInterval) ;or this
			Lines := Round(A * T**2 + B * T + C)
		}
		Else ;Default curve is straigth line
		{
			;f(t) = At + B
			A := (MaxLines - MinLines) / (MinInterval - Threshold)
			B := MaxLines - (A * MinInterval)
			Lines := Round(A * T + B)
		}
	}
	Return Lines
}

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: Aqualest, jdfnnl and 339 guests