I want to simultaneously scroll two windows, but the hotkey input method requires me to duplicate it multiple times. My idea is to use Function Hotkeys and A_ThisHotKey
variable, but the WheelDown
is disable in the program if using this script:
WheelDown::
ScrollKey := A_ThisHotKey
SetTitleMatchMode, 2
IfWinActive, Writer
{
CoordMode, Mouse, Screen
WinGet, active_id, ID, A
IfWinExist, Sumatra
{
Send {ScrollKey}
WinActivate ; Automatically uses the window found above.
Send {ScrollKey}
Send {ScrollKey}
WinActivate, ahk_id %active_id%
}
}
Else
{
Send {A_ThisHotKey}
}
return
I want ScrollKey
to match WheelUp
, WheelDown
, PgUp
, PgDn
, Up
, Down
.
Ideally, I think the script should detect how much the first program is scrolled, then apply that amount to the second one. Advantages:
- Scrolling will be seamless since the other program are scrolled in the background
- Clicking on the scrollbar works
- Different scrolling speeds don't affect the comparison
- Moving lines in text editors won't scroll pages in PDF viewers
FYI: Send/SendRaw/SendInput/SendPlay/SendEvent: Send keys & clicks
How to grab the scrolling amount in one window?
Also asked on Reddit: How to simultaneously scroll two windows?
A_ThisHotKey
but it doesn't work – Ooker