如何同时滚动两个窗口? [英] How to simultaneously scroll two windows?
问题描述
我想同时滚动两个窗口,但是热键输入法要求我重复多次.我的想法是使用功能热键和
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
我希望ScrollKey
匹配WheelUp
,WheelDown
,PgUp
,PgDn
,Up
,Down
.
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:
- 由于其他程序在后台滚动,因此滚动将是无缝的
- 单击滚动条即可
- 不同的滚动速度不会影响比较
- 在文本编辑器中移动行不会在PDF查看器中滚动页面
FYI:发送/SendRaw/SendInput/SendPlay/SendEvent:发送密钥和点击次数
如何在一个窗口中获取滚动量?
还在Reddit上问:如何同时滚动两个窗口?
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?
推荐答案
尝试一下
#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
这篇关于如何同时滚动两个窗口?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!