scroll two google chrome windows togethers

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
anhnha
Posts: 116
Joined: 08 Aug 2018, 02:46

scroll two google chrome windows togethers

20 Aug 2018, 06:15

I am planing to write a small code for studying Korean by reading comic in two languages in parallel.
I will open two windows on chrome, one is in Korean and the other is in Vietnamese.
If I choose a place to be start, then from that if I scroll one page, the other will move exactly the same. Could anyone suggest how to do this?
https://comic.naver.com/webtoon/detail. ... 1&weekday=
https://truyenqq.com/truyen-tranh/nano- ... hap-1.html

Image
Attachments
comic.png
(254.16 KiB) Not downloaded yet
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: scroll two google chrome windows togethers

20 Aug 2018, 11:49

I might do something like this. Cheers.

Code: Select all

q:: ;google chrome - scroll multiple windows
WinGet, hWnd1, ID, A
DetectHiddenWindows, Off
WinGet, vWinList, List, ahk_class Chrome_WidgetWin_1
Loop, % vWinList
{
	hWnd := vWinList%A_Index%
	WinActivate, % "ahk_id " hWnd
	ControlSend,, {PgDn}, % "ahk_id " hWnd
}
WinActivate, % "ahk_id " hWnd1
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
anhnha
Posts: 116
Joined: 08 Aug 2018, 02:46

Re: scroll two google chrome windows togethers

20 Aug 2018, 15:45

Thank you very much.
I'd like to change the hotkey q by middle mouse scroll. Also it would be great if they can scroll together both directions downward and upward.
How to modify this?
I changed it like this:

Code: Select all

WheelDown:: ;google chrome - scroll multiple windows
WinGet, hWnd1, ID, A
DetectHiddenWindows, Off
WinGet, vWinList, List, ahk_class Chrome_WidgetWin_1
Loop, % vWinList
{
	hWnd := vWinList%A_Index%
	WinActivate, % "ahk_id " hWnd
	ControlSend,, {PgDn}, % "ahk_id " hWnd
}
WinActivate, % "ahk_id " hWnd1
return
WheelUp:: ;google chrome - scroll multiple windows
WinGet, hWnd1, ID, A
DetectHiddenWindows, Off
WinGet, vWinList, List, ahk_class Chrome_WidgetWin_1
Loop, % vWinList
{
	hWnd := vWinList%A_Index%
	WinActivate, % "ahk_id " hWnd
	ControlSend,, {PGUP}, % "ahk_id " hWnd
}
WinActivate, % "ahk_id " hWnd1
return
Esc::ExitApp
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: scroll two google chrome windows togethers

20 Aug 2018, 17:27

- I've changed the script a bit to use WheelUp/WheelDown, as you asked.
- If anyone has some more ideas for improving this, that would be great. It could do with some improvement, it's a bit jerky at present.

Code: Select all

#IfWinActive ahk_class Chrome_WidgetWin_1
WheelUp:: ;google chrome - scroll multiple windows
WheelDown::
if (A_TimeIdle > 500)
	return
WinGet, hWnd1, ID, A
DetectHiddenWindows, Off
WinGet, vWinList, List, ahk_class Chrome_WidgetWin_1
vKeys := InStr(A_ThisHotkey, "Up") ? "{PgUp}" : "{PgDn}"
Loop, % vWinList
{
	hWnd := vWinList%A_Index%
	WinActivate, % "ahk_id " hWnd
	ControlSend,, % vKeys, % "ahk_id " hWnd
}
WinActivate, % "ahk_id " hWnd1
return
#IfWinActive
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: aitaixy, dipahk and 210 guests