MouseMove script inconsistent on 2nd monitor Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
johnnyboy40010
Posts: 2
Joined: 10 Aug 2019, 14:44

MouseMove script inconsistent on 2nd monitor

10 Aug 2019, 15:03

Hello,

I recently updated Windows 10 to version 1903 and now I have trouble with a basic MouseMove left/right click script when using it on my 2nd monitor. Here is the script:

1::Rbutton
2::MouseMove 0, 112, 0, R
3::Lbutton
`::Suspend
Delete::
ExitApp
Return


When I use this script on my primary monitor, hitting [2] moves the mouse 112 downward, as expected. When I use the script on my 2nd monitor, it moves left and downward, and also increases in distance with each keystroke.

Here are two gifs for comparison.
First monitor: https gyazo.com /6713bd5bc3126c9d64d252293370c669 Broken Link for safety
Second Monitor: https gyazo.com /1f738153003e6d7be5d5be479c4af3b7 Broken Link for safety

Other relevant info for trouble shooting: Monitor 1 display settings are 150% scale, 1920x1080. Monitor 2 display settings are 100% scale, 1680x1050.


My goal is for the 2nd monitor to behave as the first one and drop the same distance every time. Thank you!
gregster
Posts: 9098
Joined: 30 Sep 2013, 06:48

Re: MouseMove script inconsistent on 2nd monitor  Topic is solved

10 Aug 2019, 19:12

Welcome to the forum!

I seem to remember that there were sometimes problems with multiple monitors (especially with differing setups). The MouseMove docs also say:
https://www.autohotkey.com/docs/commands/MouseMove.htm#Remarks wrote:The following is an alternate way to move the mouse cursor that may work better in certain multi-monitor configurations:

DllCall("SetCursorPos", "int", 100, "int", 400) ; The first number is the X-coordinate and the second is the Y (relative to the screen).
So, I would first try this:

Code: Select all

2::
CoordMode, Mouse, Screen
MouseGetPos, X, Y
Y += 112
DllCall("SetCursorPos", "int", X, "int", Y)
return 
(assuming that MouseGetPos returns the correct coords - which you might want to check, if this doesn't work)
johnnyboy40010
Posts: 2
Joined: 10 Aug 2019, 14:44

Re: MouseMove script inconsistent on 2nd monitor

12 Aug 2019, 23:04

gregster wrote:
10 Aug 2019, 19:12
Welcome to the forum!

I seem to remember that there were sometimes problems with multiple monitors (especially with differing setups). The MouseMove docs also say:
https://www.autohotkey.com/docs/commands/MouseMove.htm#Remarks wrote:The following is an alternate way to move the mouse cursor that may work better in certain multi-monitor configurations:

DllCall("SetCursorPos", "int", 100, "int", 400) ; The first number is the X-coordinate and the second is the Y (relative to the screen).
So, I would first try this:

Code: Select all

2::
CoordMode, Mouse, Screen
MouseGetPos, X, Y
Y += 112
DllCall("SetCursorPos", "int", X, "int", Y)
return 
(assuming that MouseGetPos returns the correct coords - which you might want to check, if this doesn't work)

Thank you! This script works on both monitors :D

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: peter_ahk, PuzzledGreatly, Rohwedder, Stinkfoot9 and 143 guests