Question about Code for Duel Scrolling in AutoHotKey?

davejonescue

Puritan Board Junior
Hello, is there anybody versed in AutoHotKey? I am trying to create a script or executable that will allow me to use Word as my reference, but scroll in Foxit Reader when I scroll in Word. Below is the script ChatGPT gave me, but I dont really know how to code, or where to start, but that it is not working after running the script and opening up both Word and Foxit Reader.

User


Can you create an AutoHotKey script that will allow me to Scroll both Microsoft Word and Foxit PDf Reader at the same time, using Microsoft Word as the rule?

Certainly! Below is an AutoHotKey script that allows you to scroll both Microsoft Word and Foxit PDF Reader simultaneously, with Microsoft Word as the reference:
autohotkey
SetTitleMatchMode 2 ; Match any substring in the title

#Persistent ; Keep the script running

; Function to scroll Foxit PDF Reader
ScrollFoxit() {
WinGet, id_foxit, list, Foxit Reader
Loop, %id_foxit%
{
this_id_foxit := id_foxit%A_Index%
ControlSend,, {WheelDown}, ahk_id %this_id_foxit%
}
}

#IfWinActive ahk_class OpusApp ; Microsoft Word window class
{
; Scroll Down
WheelDown::
Send {WheelDown}
ScrollFoxit() ; Call the function to scroll Foxit PDF Reader
return

; Scroll Up
WheelUp::
Send {WheelUp}
ScrollFoxit() ; Call the function to scroll Foxit PDF Reader
return
}

This script will scroll both Microsoft Word and Foxit PDF Reader simultaneously. When you scroll in Microsoft Word, it will send the same scroll command to Foxit PDF Reader. Make sure to have both Microsoft Word and Foxit PDF Reader open while running this script. Adjust the WheelDown and WheelUp keys as per your preference if you want to scroll using different keys.
 
I've never used AutoHotKey nor am I familiar with their scripting language but I suspect that these two lines:
Code:
WinGet, id_foxit, list, Foxit Reader
#IfWinActive ahk_class OpusApp ; Microsoft Word window class

are the culprit. It's looking in your system for the windows so you're going to have to figure out exactly what window it's trying to match. Probably the "Foxit Reader" process is named something different than just "Foxit Reader".
 
I've never used AutoHotKey nor am I familiar with their scripting language but I suspect that these two lines:
Code:
WinGet, id_foxit, list, Foxit Reader
#IfWinActive ahk_class OpusApp ; Microsoft Word window class

are the culprit. It's looking in your system for the windows so you're going to have to figure out exactly what window it's trying to match. Probably the "Foxit Reader" process is named something different than just "Foxit Reader".
Thank you. Yeah, the coding stuff is beyond my abilities. Just was toying around to see if I could find a way to have the Reader scroll the same time my Word did for editing. Doing it now manually isnt too difficult, I just dont play around too much with the coding stuff because I dont want to mess up my computer by giving it commands I may not understand.
 
I suspect that the auto-scrolling would be nice for a little while but would very quickly get out of sync anyway because the content being scrolled won't be matched.
 
Back
Top