Help! How to use make the mouse scroll through a specified window

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Help! How to use make the mouse scroll through a specified window

20 Jun 2018, 06:14

I need help.

I'm trying to make a script that scrolls through a PDF that's being viewed in IE.

I need to make the script to make a IE window active and points the mouse in that window over the pdf. Then presses down the mousewheel, pulling the mouse down just a little bit and holding the mousewheel down for a couple of seconds so that the whole PDF scrolls so I can view it.

I figured that ControlClick might be the command to use and I've tried to make it work but I can't. :(

I tried this but it doesn't do much:

Code: Select all

WinActivate ahk_class IEFrame
ControlClick X1803 Y185 ahk_class IEFrame X1803 Y185 Wheeldown X10 Y10 Sleep 7000 Wheelup
Can someone give a noob like me some help or ideas? :) Please....
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Help! How to use make the mouse scroll through a specified window

20 Jun 2018, 07:37

This works for me for a pdf opened in Internet Explorer:

Code: Select all

q:: ;internet explorer - WheelDown
WinActivate, ahk_class IEFrame
SendInput, {WheelDown}
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Re: Help! How to use make the mouse scroll through a specified window

20 Jun 2018, 08:05

It works but it's not exactly what I want. It's quite hard to read the text.

My goal is to get a script that makes a smoother flow when scrolling through the window. Such as when you push the mousewheel down and moves the mouse slightly down so it scrolls softly through the document.
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Help! How to use make the mouse scroll through a specified window

20 Jun 2018, 08:21

Perhaps something like this. Adjust the numbers as necessary.

Code: Select all

q:: ;internet explorer - WheelDown via WM_MOUSEWHEEL
WinGet, hWnd, ID, ahk_class IEFrame
ControlGetFocus, vCtlClassNN, % "ahk_id " hWnd
ControlGet, hCtl, Hwnd,, % vCtlClassNN, % "ahk_id " hWnd
vNum := -60 ;negative means downwards
vPosX := A_ScreenWidth/2
vPosY := A_ScreenHeight/2
Loop, 2 ;sometimes it only appeared to work half the time
	PostMessage, 0x20A, % vNum<<16, % vPosX|(vPosY<<16),, % "ahk_id " hCtl ;WM_MOUSEWHEEL := 0x20A
return
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA
Straut
Posts: 11
Joined: 22 May 2018, 02:49

Re: Help! How to use make the mouse scroll through a specified window

20 Jun 2018, 08:56

Thanks.... But I don't get it to run. I have to hold Q to make it run... Do you know why?
User avatar
jeeswg
Posts: 6902
Joined: 19 Dec 2016, 01:58
Location: UK

Re: Help! How to use make the mouse scroll through a specified window

20 Jun 2018, 08:58

To make it loop you can use Loop and Sleep, otherwise I'm not sure.
homepage | tutorials | wish list | fun threads | donate
WARNING: copy your posts/messages before hitting Submit as you may lose them due to CAPTCHA

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: RussF and 385 guests