프로그래밍

[ahk]마우스 휠 가속

do121 2023. 7. 3. 06:29

https://www.autohotkey.com/boards/viewtopic.php?t=86715 

 

Fast Scrolling Script (alternative to Logitech infinite scroll wheel) - AutoHotkey Community

Post your working scripts, libraries and tools for AHK v1.1 and older a0l0e0x000 Posts: 14 Joined: 26 Dec 2020, 08:27 @ Quote 09 Feb 2021, 13:23 When holding Right mouse button scrolling with the scroll wheel will be accelerated. If you press the Right mou

www.autohotkey.com

RButton::
FastScroll := 0
hotkey, Wheelup , HK1, on
hotkey, Wheeldown , HK2, on
keywait, RButton
hotkey, Wheelup , HK1, off
hotkey, Wheeldown , HK2, off
if (FastScroll = 0)
{
send, {RButton}
}
return

HK1:
send, {wheelup 4}
if (FastScroll = 0)
{
FastScroll := 1
}
return

HK2:
send, {wheeldown 4}
if (FastScroll = 0)
{
FastScroll := 1
}
return

 

https://www.autohotkey.com/boards/viewtopic.php?t=86715 

 

Fast Scrolling Script (alternative to Logitech infinite scroll wheel) - AutoHotkey Community

Post your working scripts, libraries and tools for AHK v1.1 and older a0l0e0x000 Posts: 14 Joined: 26 Dec 2020, 08:27 @ Quote 09 Feb 2021, 13:23 When holding Right mouse button scrolling with the scroll wheel will be accelerated. If you press the Right mou

www.autohotkey.com

; Accelerated Scrolling
; V1.3
; By BoffinbraiN

#NoEnv
#NoTrayIcon
#SingleInstance
#MaxHotkeysPerInterval 120

Process, Priority, , H
SendMode Input

; Show scroll velocity as a tooltip while scrolling. 1 or 0.
tooltips := 0

; The length of a scrolling session.
; Keep scrolling within this time to accumulate boost.
; Default: 500. Recommended between 400 and 1000.
timeout := 500

; If you scroll a long distance in one session, apply additional boost factor.
; The higher the value, the longer it takes to activate, and the slower it accumulates.
; Set to zero to disable completely. Default: 30.
boost := 30

; Spamming applications with hundreds of individual scroll events can slow them down.
; This sets the maximum number of scrolls sent per click, i.e. max velocity. Default: 60.
limit := 60

; Runtime variables. Do not modify.
distance := 0
vmax := 1

; Key bindings
WheelUp::    Goto Scroll
WheelDown::  Goto Scroll
#WheelUp::   Suspend
#WheelDown:: Goto Quit

Scroll:
	t := A_TimeSincePriorHotkey
	if (A_PriorHotkey = A_ThisHotkey && t < timeout)
	{
		; Remember how many times we've scrolled in the current direction
		distance++

		; Calculate acceleration factor using a 1/x curve
		v := (t < 80 && t > 1) ? (250.0 / t) - 1 : 1

		; Apply boost
		if (boost > 1 && distance > boost)
		{
			; Hold onto the highest speed we've achieved during this boost
			if (v > vmax)
				vmax := v
			else
				v := vmax

			v *= distance / boost
		}

		; Validate
		v := (v > 1) ? ((v > limit) ? limit : Floor(v)) : 1

		if (v > 1 && tooltips)
			QuickToolTip("?v, timeout)

		MouseClick, %A_ThisHotkey%, , , v
	}
	else
	{
		; Combo broken, so reset session variables
		distance := 0
		vmax := 1

		MouseClick %A_ThisHotkey%
	}
	return

Quit:
	QuickToolTip("Exiting Accelerated Scrolling...", 1000)
	Sleep 1000
	ExitApp

QuickToolTip(text, delay)
{
	ToolTip, %text%
	SetTimer ToolTipOff, %delay%
	return

	ToolTipOff:
	SetTimer ToolTipOff, Off
	ToolTip
	return
}

'프로그래밍' 카테고리의 다른 글

sql 명령어 예제  (0) 2024.05.15
반복클릭 chatgpt  (0) 2023.04.07
esc 두번 눌러 창닫기  (0) 2023.02.15
github 사용법 간단  (0) 2022.11.28