Mouse movement based on a variable - where am I going wrong?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
aglanija
Newbie
Posts: 6
Joined: Tue Mar 16, 2021 10:09 am

Mouse movement based on a variable - where am I going wrong?

Post by aglanija » Fri May 14, 2021 5:07 am

Good morning from England.

I am trying to produce a bit of code based on using a variable for positioning the mouse.

So, every 70 pixels or so, I want to left-click and select something from a dropdown list, save it as a print screen, bounce back to the original position, then select the next thing which is 70 pixels further down, save it as a print screen, bounce back to the original position, and so on, until I reach the bottom of the list.

The first thing I want to select is approximately 1277 pixels from the top of the screen. So, the second thing will be (1277+70) pixels, the third thing (1277+140) pixels...

For now, I am not too bothered about the print screen. I just want to get it selecting things in the way my mind is envisaging.

I came up with this:

Label>cycle
Let>orig=1277
Let>multi=0
Let>prod=70*multi
Let>total=orig+prod

MouseMove>2000,orig
LClick
Wait>2

MouseMove>2000,total
LClick
Wait>2

MouseMove>2000,orig
LClick
Wait>2

Let>multi=multi+1
If multi<5
Wait>1
Goto>cycle
Endif


So, the first thing should be 1277 + (70*0) pixels from the top of the screen, the second 1277 + (70*1) pixels, etc.

But the mouse does not move down. It just stays at 1277 pixels, cycling over the same thing time and time again.

Where am I going wrong, please?

User avatar
Grovkillen
Automation Wizard
Posts: 998
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: Mouse movement based on a variable - where am I going wrong?

Post by Grovkillen » Fri May 14, 2021 7:45 am

You're setting Let>multi=0 in the beginning of each iteration. Move it above the label>cycle.
Let>ME=%Script%

Running: 15.0.24
version history

aglanija
Newbie
Posts: 6
Joined: Tue Mar 16, 2021 10:09 am

Re: Mouse movement based on a variable - where am I going wrong?

Post by aglanija » Fri May 14, 2021 8:03 am

Thank you!

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