When i got myself another monitor, the feature that i looked for the most was the ability to code in one monitor and see the "what to do" list on the other monitor.
But the problem was that i had to scroll the window with the "to do list" and for that, I'd have to use my mouse, or alt-tab into it.
So, i created a ahk script to do what the ctrl+meta+v key does in emacs: scroll the other window.
This script has the ability of storing 9 windows and scroll each of them, restoring the focus to the original window after it scrolls the others.
In early times, it used MW_VSCROLL message, but that message doesn't work with adobe acrobat, so, i changed it to the "send" keys, so now it activates the window, sends specified keys to scroll the window, and reactivates the last window.
I hope you like it:
#SingleInstance, Force
;Pressing win+alt+numpad# stores the current window under #.
;For scrolling up the # window, press win+#
;For scrolling down the #window, press ctrl+win+#
KeyUp={Up} ;the Up arrow will be sent to scroll up
KeyDown={Down} ;the down arrow will be sent to scroll the window down.
;To use the page up and down to scroll the windows, replace 'up' and
;'down' by PgUp and PgDn
loop 9
{
MMWindow%A_Index%=
MMWinCtrl%A_Index%=
Hotkey,!#Numpad%A_Index%, Save
Hotkey,#NumPad%A_Index%, ScrollDown
Hotkey,^#NumPad%A_Index%, ScrollUp
}
return
Save:
StringRight, MMKeyID, A_ThisHotkey, 1
MMWindow%MMKeyID% :=WinActive("a")
MouseGetPos, , , , MMWinCtrl%MMKeyID%,
Return
ScrollDown:
LastWindow :=WinActive("a")
StringRight, MMKeyID, A_ThisHotkey, 1
MMWinID :=(MMWindow%MMKeyID%)
MMWinCtrlID := (MMWinCtrl%MMKeyID%)
WinActivate, ahk_id %MMWinID%
loop
{
Send,{Down}
GetKeyState, state, Numpad%MMKeyID%, P
If state = u
break
}
WinActivate, ahk_id %LastWindow%
return
ScrollUp:
LastWindow :=WinActive("a")
StringRight, MMKeyID, A_ThisHotkey, 1
MMWinID :=(MMWindow%MMKeyID%)
MMWinCtrlID := (MMWinCtrl%MMKeyID%)
WinActivate, ahk_id %MMWinID%
loop
{
Send,%KeyUp%
GetKeyState, state, Numpad%MMKeyID%, P
If state = u
break
}
WinActivate, ahk_id %LastWindow%
return