Jump to content

Dual Monitor MouseMove and MouseClickDrag problem


Domino
 Share

Recommended Posts

AutoIt V1.14 (20220122)  Windows-10 with 2 monitors 
The displays are organized as on picture1.

P1.JPG.7f88611b738187f6d8b4cc744e293e1d.JPG

Display 1 (Main display) = 3440*1440 Landscape
Display 2 (on main's right side) = 1440*2560 Portrait

I use the following AutoIt code:

$w = 200
$h = 200
$x00 = 4000
$y00 = 1000

Dim $aS[4]
$aS[0]=10
$aS[1]=25
$aS[2]=50
$aS[3]=100

Dim $aX[4]
$aX[0]=$x00 - 350
$aX[1]=$x00 + 350
$aX[2]=$x00 + 350
$aX[3]=$x00 - 350

Dim $aY[4]
$aY[0]=$y00 - 400
$aY[1]=$y00 - 400
$aY[2]=$y00 + 400
$aY[3]=$y00 + 400

For $i = 0 to UBound($aS) -1
    $SPEED_DRAG = 100    or   $SPEED_DRAG = $aS[$i]
    $x0 =  $aX[$i]
    $y0 =  $aY[$i]
    MouseClickDrag($MOUSE_CLICK_LEFT, $x0,    $y0,    $x0+$w, $y0,    $SPEED_DRAG)
    MouseClickDrag($MOUSE_CLICK_LEFT, $x0+$w, $y0,    $x0+$w, $y0+$h, $SPEED_DRAG)
    MouseClickDrag($MOUSE_CLICK_LEFT, $x0+$w, $y0+$h, $x0,    $y0+$h, $SPEED_DRAG)
    MouseClickDrag($MOUSE_CLICK_LEFT, $x0,    $y0+$h, $x0,    $y0,    $SPEED_DRAG)
Next

This code is supposed to draw 4 squares.

As expected on Display 1 4 sqares are drawn.

However on Display 2 no sqares are drawn.

Picture 2 shows the result when the speed is kept the same during the whole experiment ($SPEED_DRAG = 100).
Each of the 4 drawings are different because of the position on the Display.
Also, The MouseClickDrag does 2 sweeps here, one drawing, the second one not drawing, only moving.
Although each sweep starts from a different place, the 2 sweeps end at the same place. Their ways are also different.
The second sweep does not produce any trace, but its existence is also strange.

P2.thumb.jpg.c3f0cb5900f4f423ff71f3b1beca5433.jpg

 

Picture 3 shows what happens when the drawing speed is changed (from 10 to 100).
Each of the 4 drawings are different because of the drawing speed.
The comment about the 2 sweeps is also valid here.

Replacing MouseClickDrag by MouseMove gives the same erratic behaviour.

Is this problem avoidable?

P3.thumb.jpg.5406742bcaf69692e3b664f0cdd7377a.jpg

Link to comment
Share on other sites

I swapped the extended display from right to left, but this has no impact on the behaviour.

Pb1.JPG.e6f35ab6afae227ab4cea1165e5f258e.JPG

Then I made het test program more clear.

I draw 10 horizontal lines and 10 vertical lines with the following script:

Opt("MouseCoordMode", 1) ;1=absolute, 0=relative, 2=client
$w = 1100
$h = 1200
$x0 = -1300
$y0 = 300
$SPEED_DRAG = 100
For $i = 0 to 10
    MouseClickDrag($MOUSE_CLICK_LEFT, $x0, $y0, $x0+$w, $y0, $SPEED_DRAG)
    $y0 += $h / 10
Next
ChangeColor()
$y0 = 1300
For $i = 0 to 10
    $x0 += $w / 10
    MouseClickDrag($MOUSE_CLICK_LEFT, $x0, $y0, $x0, $y0+$h, $SPEED_DRAG)
Next

The result is still very strange. Each sweep starts with an overshoot and very slowly returns to the expected line.

In addition the overshoot and the resulting lines  have different shapes.

Lines.thumb.png.f7d24a14cf9a86904256090f241ac286.png

 

This bothered me a lot until I found the cause of this behaviour, hence the solution to this problem. EUREKA.

Both displays had their "Recommended" Scale and Layout (cfr. Windows Display settings).

In detail the Main screen (Display 1) stayed at 100% where Display 2 (extended display) was set at the recommended scale of 125%.

With these different scales, not too disrupting for normal work, the move and drag mouse commands were useless.

Link to comment
Share on other sites

So, you solved it?

Quote

This bothered me a lot until I found the cause of this behaviour, hence the solution to this problem. EUREKA.

Both displays had their "Recommended" Scale and Layout (cfr. Windows Display settings).

In detail the Main screen (Display 1) stayed at 100% where Display 2 (extended display) was set at the recommended scale of 125%.

With these different scales, not too disrupting for normal work, the move and drag mouse commands were useless.

 

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...