Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Send mouse scrolls to window under mouse


  • Please log in to reply
142 replies to this topic
Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Another idea: instead of sending wheel events, if these funny windows are below the mouse, send scroll up or down events.

Babis
  • Members
  • 69 posts
  • Last active: Aug 26 2015 09:31 AM
  • Joined: 08 Dec 2005

CoordMode Mouse, Screen
Loop 31
   S%A_index% := Round(.5*1.222**A_Index)*(120 << 17) ; doubled, to optimize code

#MaxThreadsPerHotkey 2
WheelDown::
WheelUp::
   Speed := 1 + 300//(A_TickCount-Tick0+10)
   Tick0 = %Tick%
   Tick  = %A_TickCount%
   WCnt  += S%Speed%
   If (Tick < WTick + 30)
      Return
   WTick = %Tick%
   MouseGetPos m_x, m_y, WinID, Ctrl
   PostMessage 0x20A,((A_ThisHotKey="WheelUp")-.5)*WCnt,(m_y<<16)|m_x,%Ctrl%,ahk_id %WinID%
   WCnt = 0
Return


I will stick with this version atm

evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005

instead of sending wheel events, if these funny windows are below the mouse, send scroll up or down events


I thought of just sending WheelUp/Down in the first place, but I don't see that there's any way to direct a wheel event at a specific control... ControlClick doesn't have an option for the Wheel, only other mouse buttons (and ControlSend can't send mouse-related actions).

travis.hume
  • Guests
  • Last active:
  • Joined: --
If you aren't familar with the Eclipse programmers IDE then disregard, but if you do use Eclipse ... The script does not scrool "Fast View" windows.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Have you tried replacing the wheel event messages with scroll up or down messages?

travis.hume
  • Guests
  • Last active:
  • Joined: --
For the quick reply and that changed worked great.

travis.hume
  • Guests
  • Last active:
  • Joined: --
That didn't work. I've never written any AHK script ... so I tried changing
PostMessage 0x20A to
PostMessage 0x115

Which stops all scrolling on any window. I'll keep reading.

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
For Windows CE (should be the same for most Windows versions), read http://msdn.microsof...fwm_vscroll.asp for the parameters.

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005
To add some items to the bug list, not only Laszlo´s latest script but all other scripts also do not work with Firefox, Internet Explorer and - because the same control is used - the content pane of Windows Help (hh.exe): These controls do not scroll any more even if the window has the focus!

I don´t think I have a very special system setup, just a german XP Pro SP2, admin rights, no other scripts or window manipulating software running.
Is it really just me having probs with these obvious programs?

Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
It could be a mouse driver issue. Maybe it does not generate the proper wheel events. These scripts work for me in MSIE6 and Windows Help (XP SP2 US-English). Have you tried MS IntelliMouse? Also, there are mouse settings in TweakUI.

RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

It could be a mouse driver issue.

Good point!
I already use the latest version of IntelliPoint and also IntelliType. Maybe these programs interfere in some way because I found a very strange behavior:
My MS keyboard also has a scroll wheel - and exactly in the windows where the mouse wheel is disfunctional, the keyboard wheel works! :shock:
So for me the solution will be using KatMouse which works fine with my hardware combination.

Nevertheless, thanks for pointing me in the right direction - it saved me a lot of investigation!

TheLeO
  • Members
  • 264 posts
  • Last active: Jan 02 2012 01:51 AM
  • Joined: 11 Jun 2005
I personally can't stand laggy scrolling, it's horrible..
but i really like the idea of scrolling windows under the mouse,

I used Testers first script and changed it a little.

The scipt below uses the fact that:
•if you scroll outside of the active window, the window usually doesnt pick up the event.

it doesn't stop *natural* scroll wheel events. but rather sends additional scroll events to windows underneath the mouse if the window below the mouse is not the active one(preventing double scrolling)..

works fine for most of the windows, but some times/occasionnaly you get the inventalbe bug of both windows scrolling.

I the usefullness makes up for the bug.


CoordMode Mouse, Screen 
WheelTime  = 500 
WheelDelta:= 120 << 16
WheelMax  := 4 * WheelDelta 


~WheelUp:: 
~WheelDown:: 
WinGet, V_CurrentWindowID, ID, A
MouseGetPos,,, V_WinUnderMouseID
WinGetTitle, V_CurrentWinTITLE, ahk_id %V_CurrentWindowID%
WinGetTitle, V_WinUnderMouseTITLE, ahk_id %V_WinUnderMouseID%

If ( ((V_CurrentWinTITLE) = (V_WinUnderMouseTITLE)) AND ((V_CurrentWindowID) = (V_WinUnderMouseID))  )
  Return

   Critical 
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime) 
        WCnt = %WheelDelta% 
   Else If (WCnt < WheelMax) 
        WCnt+=  WheelDelta 
   MouseGetPos m_x, m_y 
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y) 
If (A_ThisHotKey) = "~WheelUp"
  SendMessage 0x20A, WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL 
Else
  SendMessage 0x20A,-WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL 
return

::
I Have Spoken
::

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006
I'm using the first accelerated version of shimanov's code. Thanks to all involved here. But I don't know clearly yet where and how this "KatMouse" functionality will improve my workflow?

I tried to add some wheel acceleration code to Shimanov's script. Experiment with this

CoordMode Mouse, Screen

WheelTime  = 500
WheelDelta:= 120 << 16
WheelMax  := 4 * WheelDelta

WheelUp::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+=  WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A, WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return

WheelDown::
   Critical
   If (A_ThisHotKey <> A_PriorHotKey OR A_TimeSincePriorHotkey > WheelTime)
        WCnt = %WheelDelta%
   Else If (WCnt < WheelMax)
        WCnt+=  WheelDelta
   MouseGetPos m_x, m_y
   hw_m_target := DllCall("WindowFromPoint", "int",m_x, "int",m_y)
   SendMessage 0x20A,-WCnt, (m_y<<16)|m_x,,ahk_id %hw_m_target% ; WM_MOUSEWHEEL
return


RobOtter
  • Members
  • 133 posts
  • Last active: Jul 24 2014 11:29 AM
  • Joined: 30 Jan 2005

I'm using the first accelerated version of shimanov's code. Thanks to all involved here. But I don't know clearly yet where and how this "KatMouse" functionality will improve my workflow?

That´s an easy one: It improves it in the same way the scripts listed here - it will save you a lot clicks since you don´t have to activate the area you want to scroll by clicking it. A good example is the Windows Explorer: to scroll in either the tree view (left pane) or the file list (right pane), just move the mouse over the pane and go scrolling - no need to click into the pane (and eventually lose selection of files).

I personally prefer KatMouse over these scripts because I use it for years now and it works flawlessly at all times. Why should I bother finding out if one these scripts do also? KatMouse is also freeware and has a small footprint, too.

automaticman
  • Members
  • 658 posts
  • Last active: Nov 20 2012 06:10 PM
  • Joined: 27 Oct 2006

I personally prefer KatMouse over these scripts because I use it for years now and it works flawlessly at all times. Why should I bother finding out if one these scripts do also? KatMouse is also freeware and has a small footprint, too.

Thanks for further examples. I can understand your point. Btw. even if KatMouse would use much more resources there's also another principle: "Never change a running system." (This is especially true for Vista users who give away anyway lots of resources.)

? What is the most flexible use for the middle mouse button (as we have found a very good one for the wheel now). I would like to make it dependent on the used application. KatMouse seems to have an option for "pushing windows into the background" if I understood it correctly from the description on its website.