6

I usually have two instances of my web browser running side by side in my screen. When I read news or an article from a foreign language, I have it translated at one browser covering the half of the screen, and the original article running in the other window covers the other half of the screen.

Now, I want to be able to scroll down two pages running on two separate instances of the same browser simultaneously so that I can compare translated and original texts. I either use Firefox or Chrome. Is there a way to make it work simultaneous scroll down feature?

2
  • Short answer: No – DavidPostill Oct 3 '18 at 11:22
  • 1
    @DavidPostill: I think I know how this can be done. Will give a verified answer after some testing. – harrymc Oct 3 '18 at 11:36
5

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
4
  • Suppose you had numbered paragraphs on each of the two web pages. Could autohotkey parse the webpage to keep the two pages in sync (when paragraph labeled 5. is at the top of the left window, autohotkey would scroll the right window so that paragraph 5 is at the top of the right window)? – Gardener Apr 18 '19 at 15:26
  • 1
    @Gardener: It probably could, but that's another (and more complicated) question. – harrymc Apr 18 '19 at 16:00
  • Thank you. Most of the dual language pages I view have numbered paragraphs (Bible verses and such), so the numbering is already there. Interesting original question from the OP and great solution! – Gardener Apr 18 '19 at 16:03
  • Thank you, thank you, thank you! This truly is going to improve my life by several orders of magnitude. Looking forward to tweaking this at some point to add some granularity of control over scroll increment and speed. But excellent as is. – Carley Dec 11 '20 at 15:43
0

you can try this https://github.com/takatama/sync-scroll-chrome-extension. It is a chrome extension, just open chrome://extensions/, click Load unpacked, open code you just download, enjoy it !!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.