Scroll down simultaneously in side-by-side browser windows
This can be done with AutoHotkey magic by using the
following script, which should be stored in an .ahk
file for execution.
Double-click the file to start the script, stop it by right-click in the traybar
on the green "H" icon and choose Exit.
The script is written for the coordinated scrolling of two windows. You have to select first the windows to scroll by including them one by one. The script duplicates the following keys for coordinated scrolling : Wheel Up, Wheel Down, Page Up, Page Down.
The script uses some hotkeys for initialization. You can edit it to use some other hotkeys or remove unneeded ones. The ones I chose are described below.
F1 : Starts a new group of windows
F2 : Includes the currently active window in the group
F3 : Shows the windows in the group even if minimized
F4 : Closes all windows in the group
Here is the script. It worked in my tests.
#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.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
Process, Priority, , High
SetWinDelay 0
g = 1 ; Used to generate unique group names
; Reload script to reinitialize all variables, since there is no delete group
f1::
Reload
return
; Add currently active window to the group
f2::
WinGet, active_id, ID, A
GroupAdd, grpname, ahk_id %active_id%
return
; Restore all windows in the group to be visible
f3::WinRestore, ahk_group grpname
return
; Close all windows in the group
f4::GroupClose, grpname , A
Reload
return
; This intercepts scroll keys on the active window and duplicates them on the other window
#IfWinActive ahk_group grpname
WheelUp::
WheelDown::
PgUp::
PgDn::
MouseGetPos, mX, mY ; remember mouse position in current window
Send {%A_ThisHotKey%}
GroupActivate grpname ; activate the next window of this group
If (A_ThisHotKey = "WheelUp" || A_ThisHotKey = "WheelDown")
MouseMove, 200, 200, 0 ; move the mouse over the currently active window
Send {%A_ThisHotKey%}
GroupActivate grpname ; Activate previous window
MouseMove, mX, mY, 0 ; Restore its mouse position
return