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:
Try this
#SingleInstance Force
Process, Priority, , High
; SetTitleMatchMode, 2
GroupAdd, Scroll_Group, ahk_class Notepad
GroupAdd, Scroll_Group, ahk_class Notepad++
SetWinDelay 0
#If (WinActive("ahk_class Notepad") && WinExist("ahk_class Notepad++")) || (WinActive("ahk_class Notepad++") && WinExist("ahk_class Notepad"))
WheelUp::
WheelDown::
PgUp::
PgDn::
Up::
Down::
MouseGetPos, mX, mY
Send {%A_ThisHotKey%}
GroupActivate Scroll_Group ; 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 Scroll_Group
MouseMove, mX, mY, 0
return
#If
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With