I am trying to make a script that scrolls all the opened PDF documents at the same time. The problem is that I can not get it to work unless I specifically name each window that has to be scrolled and send the actions to it. Also, in the current state I need to catch the scroll event in another window (ex: Notepad) but this is actually ok since I may also want to scroll some of the PDFs manually and then resume synchronous scrolling.
Here's my workflow:
- Open 2 or more PDF documents.
- Open a Notepad file and start scrolling into the notepad file.
Result: All opened PDFs start scrolling.
Here's my code (borrowed from the interwebz :)
WheelDown::
SetTitleMatchMode, 2
IfWinActive, Notepad ; Replace 'SafariTitle' by the title of the safari windows
{
CoordMode, Mouse, Screen
WinGet, active_id, ID, A
IfWinExist, Adobe
{
Send {WheelDown}
WinActivate ; Automatically uses the window found above.
Send {WheelDown}
Send {WheelDown}
WinActivate, ahk_id %active_id%
}
}
Else
{
Send {WheelDown}
}
return
WheelUp::
SetTitleMatchMode, 2
IfWinActive, Notepad ; Replace 'SafariTitle' by the title of the safari windows
{
CoordMode, Mouse, Screen
WinGet, active_id, ID, A
IfWinExist, Adobe
{
Send {WheelUp}
WinActivate ; Automatically uses the window found above.
Send {WheelUp}
Send {WheelUp}
WinActivate, ahk_id %active_id%
}
}
Else
{
Send {WheelUp}
}
return
Right now it works for scrolling only one PDF.
How can I get it to look and scroll through all of them?