Last active
November 1, 2024 16:41
-
-
Save emvaized/82201245d9581fb16727bc3977088c64 to your computer and use it in GitHub Desktop.
Parallel Scrolling script for Autohotkey
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
; Parallel scrolling | |
; Autohotkey script by @emvaized | |
; Licence: MIT | |
; | |
; Description: This Autohotkey script allows you to scroll 2 windows or any views in the same window simultaneously. | |
; When you hold down the win key, the script sends a scroll event to both the current point under the course, and a second point mirrored horizontally. | |
; Thus, by choosing the cursor position, you can achieve simultaneous scrolling of any 2 windows or 2 lists within a single window. | |
; You can adjust scrolling speed by modifying WheelTurns variable. | |
; | |
; If you hold Win+Alt, you can set any custom point for scroll by clicking on the screen, | |
; and then scrolling with both Win and Alt key pressed will also scroll at stored position | |
#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases. | |
#SingleInstance, Force | |
SendMode Input ; Recommended for new scripts due to its superior speed and reliability. | |
#KeyHistory 0 | |
ListLines Off | |
SetMouseDelay, -1 | |
; Preference for scrolling speed. Defines how much scroll events to send on every detected scroll. | |
WheelTurns := 5 | |
#WheelUp:: ScrollPoint("WheelUp", WheelTurns) | |
Return | |
#WheelDown:: ScrollPoint("WheelDown", WheelTurns) | |
Return | |
!#WheelUp:: ScrollPoint("WheelUp", WheelTurns, SavedX, SavedY ) | |
Return | |
!#WheelDown:: ScrollPoint( "WheelDown", WheelTurns, SavedX, SavedY ) | |
Return | |
; Save cursor position on Win+Alt+click | |
#!LButton:: | |
{ | |
CoordMode, Mouse, Screen | |
MouseGetPos, SavedX, SavedY | |
ToolTip, Saved point for scroll: %SavedX% x %SavedY%` | |
Sleep 1000 | |
ToolTip | |
} | |
ScrollPoint(WhichButton, WheelTurns, PasX = -1, PasY = -1) { | |
; Get desktop size and mouse position | |
CoordMode, Mouse, Screen | |
WinGetPos, , , Xmax, , Program Manager | |
MouseGetPos, MouseX, MouseY | |
Loop, %WheelTurns% { | |
; Scroll at current position | |
MouseClick, %WhichButton% , , , 1, 0, , | |
if (PasX > -1) { | |
; Move to previously saved cursor position | |
MouseClick, %WhichButton% , PasX, PasY, 1, 0, , | |
} else { | |
; Move to horizontally mirrored position and scroll | |
MouseClick, %WhichButton% , (Xmax - MouseX), MouseY, 1, 0, , | |
} | |
; Move cursor back | |
MouseMove, MouseX, MouseY ,0 , | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
This small Autohotkey script allows you to scroll 2 windows or any views in the same window simultaneously.
When you hold down the win key, the script sends a scroll event to both the current point under the course, and a second point mirrored horizontally.
Thus, by choosing the cursor position, you can achieve simultaneous scrolling of any 2 windows or 2 lists within a single window.
You can adjust scrolling speed by changing number of iterations on
Loop, 5
lineDemonstration of parallel scrolling two windows simultaneously when Win key is pressed (cursor is over left window):