#3182 closed Bug (Fixed)
MouseGetPos may return the wrong value when used with mulitple display screens.
Reported by: | philkryder | Owned by: | Jon |
---|---|---|---|
Milestone: | 3.3.15.4 | Component: | AutoIt |
Version: | 3.3.14.2 | Severity: | None |
Keywords: | MouseGetPos MouseMove | Cc: |
Description
This problem occurs when there are screens which return a negative value from MouseGetPos. These screens are to the LEFT of the "main screen."
That is, the mouse must be at a position returning negative values for x and/or y
In the code below, when the mouse is positioned to the left of the main screen, the mouse will move to the right toward the main screen, one-pixel-at-a-time.
Similarly, if there is a screen which has negative Y values,
the mouse one pixel at a time toward zero.
Please see:
https://www.autoitscript.com/forum/topic/179346-mouse-moves-when-it-shouldnt/?page=1
While(True) Sleep (1500) Local $x = MouseGetPos(0) Local $y = MouseGetPos(1) Consolewrite(@CR & "x >" & $x & "< y>" & $y & "<") MouseMove($x,$y,0) WEnd
here are the results on Windows 7
"C:\Program Files (x86)\AutoIt3\SciTE\..\AutoIt3.exe" "C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.au3" /run /prod /ErrorStdOut /in "R:\Operations\MacroTools\AutoIT\keepWindowUnlocked\TrackerCode.au3" /UserParams
+>15:47:00 Starting AutoIt3Wrapper v.15.920.938.0 SciTE v.3.6.0.0 Keyboard:00010409 OS:WIN_7/Service Pack 1 CPU:X64 OS:X64 Environment(Language:0409)
+> SciTEDir => C:\Program Files (x86)\AutoIt3\SciTE UserDir => C:\Users\Pkryder\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper SCITE_USERHOME => C:\Users\Pkryder\AppData\Local\AutoIt v3\SciTE
Running AU3Check (3.3.14.2) from:C:\Program Files (x86)\AutoIt3 input:R:\Operations\MacroTools\AutoIT\keepWindowUnlocked\TrackerCode.au3
+>15:47:00 AU3Check ended.rc:0
Running:(3.3.14.2):C:\Program Files (x86)\AutoIt3\autoit3.exe "R:\Operations\MacroTools\AutoIT\keepWindowUnlocked\TrackerCode.au3"
--> Press Ctrl+Alt+Break to Restart or Ctrl+Break to Stop
x >-3334< y>-131<
x >-3333< y>-130<
x >-3332< y>-129<
x >-3331< y>-128<
x >-3330< y>-127<
x >-3329< y>-126<
x >-3328< y>-125<
x >-3327< y>-124<
Process failed to respond; forcing abrupt termination...
Exit code: 1 Time: 13.53
Attachments (0)
Change History (7)
comment:1 Changed 9 years ago by BrewManNH
comment:2 Changed 9 years ago by philkryder
Thanks - I hesitate to say that I know what is going wrong.
I'm happy to accept that you know.
The symptom also occurs to the y coordinate as well as x.
comment:3 Changed 5 years ago by philkryder
is there any news on this? I don't really care which function is causing the error, but, it seems that one of them should be fixed?
comment:4 Changed 4 years ago by Jpm
- Owner set to Jpm
- Status changed from new to assigned
Finaly I found access to a multiple screen.
I confirm that the error was in MouseMove()
Fix Sent to Jon
comment:5 Changed 3 years ago by Jon
- Milestone set to 3.3.15.4
- Owner changed from Jpm to Jon
- Resolution set to Fixed
- Status changed from assigned to closed
Fixed by revision [12562] in version: 3.3.15.4
comment:6 follow-up: ↓ 7 Changed 3 years ago by anonymous
I believe there is still an issue with this. I have a little script that keeps my computer from going to sleep or triggering screensaver when I'm doing something else using the following loop:
While 1
Sleep(30000)
$CurPos = MouseGetPos ( )
MouseMove ( $CurPos[0] + 1, $CurPos[1] )
MouseMove ( $CurPos[0] - 1, $CurPos[1] )
WEnd
I have 3 monitors. When I'm on my left-of center monitor, every time the loop runs, the mouse cursor jumps to the left edge of the screen. Interestingly enough, if I compile it to an EXE, it will jump to the edge of the screen, then jump back to it's previous position. This is with the current beta 3.3.15.4.
comment:7 in reply to: ↑ 6 Changed 3 years ago by Jos
Replying to anonymous:
I believe there is still an issue with this. I have a little script that keeps my computer from going to sleep or triggering screensaver when I'm doing something else using the following
Please go to our forums to ask questions as this place is for Bug reports and Feature requests!
Jos
Guidelines for posting comments:
- You cannot re-open a ticket but you may still leave a comment if you have additional information to add.
- In-depth discussions should take place on the forum.
For more information see the full version of the ticket guidelines here.
As I explained in your thread it's not MouseGetPos that is at fault, it is the MouseMove that is causing this issue.
MouseMove is moving the mouse 1 pixel to the right of where it should be when the screen position is negative. It could be that MouseMove isn't taking into account that a the x dimension on the left hand monitor starts (ends?) at -1 and not at 0. So a 1920 pixel wide monitor has mouse positions from -1 to -1920, and if it were the main screen those dimensions would be 0 to 1919.