MOVE SCREENING -- LDOWN LUP

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
mpsinfo
Junior Coder
Posts: 20
Joined: Mon Apr 19, 2021 1:31 pm

MOVE SCREENING -- LDOWN LUP

Post by mpsinfo » Wed Aug 25, 2021 8:45 am

Hi, with this simple code I should translate the image on the screen, simulating dragging with the mouse.

Everything works, but while the translation from right to left moves correctly by about 3000 pixels, the one from left to right (2nd part of the code) moves only 300-400 pixels.

Non ho ancora capito come si fa ad inserisce il codice:. :oops:

Let>SX=0
Let>SY=0
Let>dir=1 // (If set Let>dir=0 the moving is correct)

//Ricava risoluzione monitor
GetScreenRes>X,Y
Msg>Resolution --> X = %X% <--> Y = %Y% // X=3440 Y=1440
Wait>1
CapsOff

Input>SX,Inserire lo spostamento orizzontale X (consigliato 3300)
Msg>Spostamento %SX%
Wait>1

Input>SY,Inserire lo spostamento verticale Y (consigliato 1300)
Msg>Spostamento %SY% // 1300
Wait>1

// Se dir = 0 allora sposto schermata vs. dx altrimenti vs. sx
If>dir=0
Msg>direzione vs. DX
Wait>1
Let>X1=%X%-50
MouseMove>%X1%,%SY%
Wait>0.2
LDown
Wait>0.2
Let>X1=%X%-%SX%
MouseMove>%X1%,%SY%
Wait>0.2
LUp
Wait>0.2
Msg>Mi sono spostato verso DX
Wait>1
Else
Msg>Direzione vs. SX
Wait>1
Let>X1=100
MouseMove>%X1%,%SY%
Wait>0.2
LDown
Wait>1
Let>X1=%X%-50
Wait>0.2
MouseMove>%X1%,%SY%
Wait>0.2
LUp
Wait>0.2
Msg>Mi sono spostato verso SX (PERO' L'IMMAGINE SI SPOSTA verso sx DI SOLO 100-200pixel anche in Y, il mouse invece lo trovo a coordinate circa x 3300 e y 1300)
Wait>2
Endif

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: MOVE SCREENING -- LDOWN LUP

Post by Dorian (MJT support) » Wed Aug 25, 2021 4:48 pm

I think the language barrier confuses things for me so this is hard to understand, but... if I enter 100 as the first value and 3000 as the second, with my resolution being 3840(X) and 2160(Y), it moves my mouse to 3790,2159. So it seems to be moving almost all the way across the screen, which seems to be what you want.

These are the variable values :

0: X1=3790
0: SY=3000
0: SX=100
0: Y=2160
0: X=3840

Are those numbers what you'd expect? If you're able to provide an English version we might find it a little more intuitive.
Yes, we have a Custom Scripting Service. Message me or go here

mpsinfo
Junior Coder
Posts: 20
Joined: Mon Apr 19, 2021 1:31 pm

Re: MOVE SCREENING -- LDOWN LUP

Post by mpsinfo » Wed Aug 25, 2021 5:47 pm

My monitor is 3440 x 1440 so I enter 3000/3300 as SX and 1200/1300 as SY

These are the variable values :

X=3440
Y=1440
SX= 3000 variable to 3300
SY= 1200 variable to 1300

X1= Before 100 next 3390


The shift of the image on the screen to the right occurs regularly but does not shift to the left, but the mouse is displayed in the correct position. It appears that LDown and drag left does not hook the video and manages to drag it.

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

Re: MOVE SCREENING -- LDOWN LUP

Post by Grovkillen » Wed Aug 25, 2021 6:03 pm

What are you trying to do? Move a window using the mouse? If so, use the move window command.
Let>ME=%Script%

Running: 15.0.27
version history

mpsinfo
Junior Coder
Posts: 20
Joined: Mon Apr 19, 2021 1:31 pm

Re: MOVE SCREENING -- LDOWN LUP

Post by mpsinfo » Thu Aug 26, 2021 9:14 am

I don't try to move a window, but its internal. I have to go through a list

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1389
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: MOVE SCREENING -- LDOWN LUP

Post by Dorian (MJT support) » Fri Aug 27, 2021 10:56 am

I wonder if the Messages are interfering with it? I'm not sure why they interfere one way but not the other. Could it also be that whatever you're selecting only allows you to drag/select in one particular way?

If I use Paint as an example, remove your Inputs for sake of testing, and remove the Messages, your code will draw a line in Paint from right to left or left to right, depending on whether dir is 0 or 1. Obviously I set up Paint and the paint pen manually first. There's no reason why Macro Scheduler would drag in one direction and not the other when all we're doing is mousemove, left down, mousemove, left up. You've already considered the timing issue, so that's good.

So try commenting out the messages and see if that helps.

Code: Select all

Let>SX=0
Let>SY=0
Let>dir=0

Let>X=3440
Let>Y=1440
Let>SX=3000
Let>SY=1200

setfocus>Untitled - Paint*
wait>1

If>dir=1
//Msg>direzione vs. DX
Wait>1
Let>X1=%X%-50
MouseMove>%X1%,%SY%
Wait>0.2
LDown
Wait>0.2
Let>X1=%X%-%SX%
MouseMove>%X1%,%SY%
Wait>0.2
LUp
Wait>0.2
//Msg>Mi sono spostato verso DX
Wait>1
Else
//Msg>Direzione vs. SX
Wait>1
Let>X1=100
MouseMove>%X1%,%SY%
Wait>0.2
LDown
Wait>1
Let>X1=%X%-50
Wait>0.2
MouseMove>%X1%,%SY%
Wait>0.2
LUp
Wait>0.2
//Msg>Mi sono spostato verso SX (PERO' L'IMMAGINE SI SPOSTA verso sx DI SOLO 100-200pixel anche in Y, il mouse invece lo trovo a coordinate circa x 3300 e y 1300)
Wait>2
Endif
Yes, we have a Custom Scripting Service. Message me or go here

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