Website Home | Blog | Software | Reviews and Features | Forum | Help | Donate | About us
topbanner_forum
  *

avatar image

Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
  • August 30, 2015, 05:36:18 PM
  • Proudly celebrating 10 years online.
  • Donate now to become a lifetime supporting member of the site and get a non-expiring license key for all of our programs.
  • donate

Author Topic: Scrolling windows other than the active one  (Read 3392 times)

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Scrolling windows other than the active one
« on: February 23, 2006, 04:44:51 AM »
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:

Code: [Select]
#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
« Last Edit: February 23, 2006, 05:36:26 AM by jgpaiva »

brotherS

  • Master of Good Ideas
  • Honorary Member
  • Joined in 2005
  • **
  • Posts: 2,122
    • View Profile
    • Donate to Member
Re: Scrolling Other windows other than the active one
« Reply #1 on: February 23, 2006, 04:52:10 AM »
Nice idea! Now all I need is a second monitor  ;D

Kniht

  • Charter Member
  • Joined in 2005
  • ***
  • gravatar avatar
  • Posts: 8
    • View Profile
    • Qxxy.com
    • Donate to Member
Re: Scrolling Other windows other than the active one
« Reply #2 on: February 23, 2006, 05:00:59 AM »
While you're at it, get me a second monitor too. This external video jack is just going to waste.

jgpaiva

  • Global Moderator
  • Joined in 2006
  • *****
  • Posts: 4,727
    • View Profile
    • Read more about this member.
    • Donate to Member
Re: Scrolling Other windows other than the active one
« Reply #3 on: February 23, 2006, 05:25:19 AM »
Nice idea! Now all I need is a second monitor  ;D
You don't really need a second monitor, this works for every window, not necessarily for windows in a second monitor.
With a few tweaks, this can work like a "fast reference" script. You can press a key to activate the window and release it to return to the window you were using before. A quite useful feature ;)