Middle Mouse Scroll?

General Macro Scheduler discussion

Moderators: Dorian (MJT support), JRL

Post Reply
NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Middle Mouse Scroll?

Post by NancyM » Tue Jul 26, 2016 10:00 pm

I don't see a function to just scroll the middle mouse button. I've got a screen where it seems the only way to scroll is via the mouse button. Am I missing something obvious? (Probably...) :P

I can't seem to get page-up/page-down to scroll in this application.

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Middle Mouse Scroll?

Post by JRL » Wed Jul 27, 2016 2:17 pm

Perhaps you need to actually select the screen before you can use keys to move around the screen. If the pages keys won't work have you tried the arrow keys? Or sometimes the app requires a ctrl or alt key with the page or arrow key.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Re: Middle Mouse Scroll?

Post by Marcus Tettmar » Wed Jul 27, 2016 2:18 pm

I'm surprised you can't page up/down.

Maybe you can use Keybd_Event and VK_MBUTTON, though I'm not sure what other parameters are needed to signify direction.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: Middle Mouse Scroll?

Post by NancyM » Wed Jul 27, 2016 4:14 pm

It is a weird application. It looks like maybe there's a window frame on top of the window I want to scroll and it always has the focus. There are a bunch of buttons on the bottom and one of them is always highlighted, even after I click on the window I want to scroll. So frustrating!

I guess I will have to resort to setting up some sort of a tab map. There are more than 60 fields I have to interact with and the tabbing isn't intuitive at all. It jumps around illogically.

Sadly there isn't a section of the screen I can anchor to using the image recognition to that doesn't scroll off.
Last edited by NancyM on Wed Jul 27, 2016 4:19 pm, edited 1 time in total.

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: Middle Mouse Scroll?

Post by NancyM » Wed Jul 27, 2016 4:17 pm

JRL wrote:Perhaps you need to actually select the screen before you can use keys to move around the screen. If the pages keys won't work have you tried the arrow keys? Or sometimes the app requires a ctrl or alt key with the page or arrow key.
I've tried paging, arrows, CTRL/ALT with paging arrows (those select tabs).

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: Middle Mouse Scroll?

Post by JRL » Wed Jul 27, 2016 7:33 pm

Here is a sample script that opens Notepad, writes a few hundred lines of text, then calls the mouse_event API using the LibFunc> command to scroll up.


In the line "LibFunc>user32,mouse_event,MERes,2048,0,0,120,0" The number "2048" tells the function to use the scroll wheel, "0,0" are x and y mouse coordinates though I have not yet figured out their usefulness. That said the cursor does need to be moved to sit over the window client area when the function is called. I used MouseMove> to move the mouse cursor to a client area location The "120" is the scroll amount with 120 being the max. 120 seems to be equivalent to one "click" on my wheel mouse. a positive number scrolls up and a negative number scrolls down. Control the scroll amount by changing the number of iterations in the "kk" repeat loop.

Any questions?

Code: Select all

RunProgram>Notepad.exe
WaitWindowOpen>Untitled - Notepad*
Wait>2
MoveWindow>Notepad*,0,0

SetFocus>Notepad*

Let>k=0
Repeat>k
  Add>k,1
  Send>%k%%crlf%
Until>k=200
Wait>1

MouseMove>100,400
SetFocus>Notepad*
Wait>2

Let>kk=0
Repeat>kk
  Add>kk,1
  LibFunc>user32,mouse_event,MERes,2048,0,0,120,0
Until>kk=100

Wait>1

**BREAKPOINT**

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: Middle Mouse Scroll?

Post by NancyM » Wed Jul 27, 2016 8:31 pm

Interesting! That might work for me. I will give it a shot. Thanks!

NancyM
Pro Scripter
Posts: 66
Joined: Mon Jul 18, 2016 7:01 pm

Re: Middle Mouse Scroll?

Post by NancyM » Wed Jul 27, 2016 9:07 pm

Woo hoo! It works! Thanks so much.

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts