AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Mouse Scroll support for any window

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Sun Jun 20, 2004 8:43 pm    Post subject: Mouse Scroll support for any window Reply with quote

This script will add mouse scroll support to those windows which inherently don't support it.

Run script.
ctrl + left click on the target window's scroll up (or left) button.
ctrl + left click on the target window's scroll down (or right) button.

that's it... now scroll normally! : )

(number of lines to be scrolled is configurable)

Code:

;___________________________________________
;______Add Scroll Support   -  Rajat________


#SingleInstance force
CoordMode, ToolTip, Screen
SetDefaultMouseSpeed, 0
SetMouseDelay, -1




lines = 3


ToolTip, Control+Left click on Scroll-Up button, 1, 1
Hotkey, ^lbutton, up


exit


up:
   Loop
   {
      GetKeyState, State, LButton
      if State = U
         Break
      Sleep, 10
   }
   Hotkey, ^lbutton, down
   MouseGetPos, upX, upY
   WinGet, winID, ID, A
   ToolTip, Control+Left click on Scroll-Down button, 1, 1
Return

down:
   Hotkey, ^lbutton, off
   MouseGetPos, dnX, dnY
   ToolTip
   Hotkey, ~WheelDown, ScrDn
   Hotkey, ~WheelUp, ScrUp
Return

ScrDn:
   IfWinNotExist, ahk_id %winID%,, ExitApp
   IfWinNotActive, ahk_id %winID%,, Return
   MouseGetPos, X, Y
   MouseClick, L, %dnX%, %dnY%, %lines%
   MouseMove, %X%, %Y%
Return

ScrUp:
   IfWinNotExist, ahk_id %winID%,, ExitApp
   IfWinNotActive, ahk_id %winID%,, Return
   MouseGetPos, X, Y
   MouseClick, L, %upX%, %upY%, %lines%
   MouseMove, %X%, %Y%
Return


Another Version
Code:

;___________________________________________
;______Add Scroll Support   -  Rajat________


#SingleInstance force
CoordMode, ToolTip, Screen
SetDefaultMouseSpeed, 0
SetMouseDelay, -1




lines = 3


ToolTip, Control+Left click on window (control) to scroll), 1, 1
Hotkey, ^lbutton, select
exit


select:
   Loop
   {
      GetKeyState, State, LButton
      if State = U
         Break
      Sleep, 10
   }
   Hotkey, ^lbutton, off
   WinGet, winID, ID, A
   ControlGetFocus, control, A
   ToolTip
   Hotkey, ~WheelDown, ScrDn
   Hotkey, ~WheelUp, ScrUp
Return


ScrUp:
   IfWinNotExist, ahk_id %winID%,, ExitApp
   IfWinNotActive, ahk_id %winID%,, Return
   Loop, %lines%
      SendMessage, 0x115, 0, 0, %control%, ahk_id %winID%
Return

ScrDn:
   IfWinNotExist, ahk_id %winID%,, ExitApp
   IfWinNotActive, ahk_id %winID%,, Return
   Loop, %lines%
      SendMessage, 0x115, 1, 0, %control%, ahk_id %winID%
Return

_________________


Last edited by Rajat on Sun Jul 25, 2004 8:30 am; edited 2 times in total
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Jul 03, 2004 5:14 pm    Post subject: Reply with quote

That's a nice idea. To summarize, my understanding is that it adds wheel support to applications that refuse to scroll in response to turning the wheel.

The following might be even better because it avoids the need to click on the controls when the script first starts. It might not work in every case. The below is from http://www.autohotkey.com/forum/viewtopic.php?t=136

; PGUP
ControlGetFocus, control, A
SendMessage, 0x115, 0, 0, %control%, A

; PGDN
ControlGetFocus, control, A
SendMessage, 0x115, 1, 0, %control%, A
Back to top
View user's profile Send private message Send e-mail
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Sat Jul 03, 2004 9:25 pm    Post subject: Reply with quote

thanx, i'll try your suggestion.

i did this script in 5 mins after i got frustrated with an app that refused to use mouse wheel. after making this script i've used it for 4-5 other apps too. its mostly for old apps that i sometimes need to use.
_________________
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Sat Jul 03, 2004 10:06 pm    Post subject: Reply with quote

I just checked it with 2 apps and its working cool. thanx!

by the way it scrolls one line at a time and not a page, which is better as i use the code thrice to scroll 3 lines.
_________________
Back to top
View user's profile Send private message
Barky



Joined: 09 Jul 2004
Posts: 3

PostPosted: Sun Jul 25, 2004 1:48 am    Post subject: Like how? Reply with quote

That has got to be the most useful script I've seen here yet. I'm not clear on how to integrate Chris' suggestion in to Rajat's script, however. Could someone clarify that for me? Thanks.
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Sun Jul 25, 2004 7:33 am    Post subject: Reply with quote

i'm short of time... but will do that soon.
_________________
Back to top
View user's profile Send private message
Rajat



Joined: 28 Mar 2004
Posts: 1717

PostPosted: Sun Jul 25, 2004 8:31 am    Post subject: Reply with quote

based on the help from Chris, I've posted another version of the script too... it works nicely.
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group