Systemwide Scroll by panning

Post your working scripts, libraries and tools for AHK v1.1 and older
a0l0e0x000
Posts: 14
Joined: 26 Dec 2020, 08:27

Systemwide Scroll by panning

Post by a0l0e0x000 » 13 Jan 2022, 11:30

Want to scroll by panning in any of the 4 directions, EVEN SIDEWAYS, as if you were operating a touchscreen?

It's simple, it's ugly, but it works.
1. Change both F22 in the code to your desired hotkey (i recommend using a macro button on your mouse)
2. Hold down the key and move mouse to scroll up/down/left/right

Code: Select all

F22::
T = 150 ; move treshold sideways
T2 = 70 ; move treshold vertical
MouseGetPos, x0, y0
while getkeystate("F22", "p")
	{
	MouseGetPos, x, y
	if (x0-x > T) {
		x0 := x0-T
		sendinput, {WheelRight}
		}
	if (x0-x < -T) {
		x0 := x0+T
		sendinput, {WheelLeft}
		}
	if (y0-y > T2) {
		y0 := y0-T2
		sendinput, {WheelDown}
		}
	if (y0-y < -T2) {
		y0 := y0+T2
		sendinput, {WheelUp}
		}
	sleep, 20
	}
return

Randy31416
Posts: 58
Joined: 15 Jan 2014, 19:09

Re: Systemwide Scroll by panning

Post by Randy31416 » 20 Jan 2022, 13:10

What a nice idea. My trouble is that my MX Revolution mouse (the best ever made) (I have two working and four spare for parts) is out of hotkeys, and the buttons on the mouse are overloaded with functions that vary by context. But I am going to adapt, and steal LeftButtonDown + RightButtonDown to dedicate to this panning logic. Will have to distinguish holding them down from any Left-Right or Right-Left rocker key logic. Thanks for the insight.

Post Reply

Return to “Scripts and Functions (v1)”