Mouse position headaches with multiple monitors

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
User avatar
Strahan
Posts: 17
Joined: 09 Dec 2016, 17:50
Location: Pennsylvania

Mouse position headaches with multiple monitors

Post by Strahan » 17 Apr 2021, 10:40

Hi. One of the frustrations of a multi monitor setup is losing my mouse. I turned on Windows accessibility high vis mouse cursor, making it larger, but it still is hard to find sometimes. So I made macros to move the mouse to center of each of my 5 monitors. To do this, I fired up wspy and moved the mouse to center and recorded the client pos (as it said recommended). Problem is, when I fire off the macro it doesn't move where the mouse was. For example, when I hit ^+F2, instead of center of LCD 2 it moves it to the upper right corner. Not snug into the corner, but close.

Macro:

Code: Select all

; Reload scripts in EditPad
;
; CTRL-SHIFT-R
;
#Persistent
#MaxHotkeysPerInterval 300
SetKeyDelay, 0
SetTitleMatchMode, 2
Menu, Tray, Icon, d:\misc\AutoHotKey_Blue.ico

Volume_Up::Volume_Down
Volume_Down::Volume_Up

Pause::ExitApp

^+F1::
	MouseMove 1461, 117
Return

^+F2::
	MouseMove 7285, -2256
Return

^+F3::
	MouseMove 1915, 602
Return

^+F4::
	MouseMove 3146, 1101
Return
I actually didn't do one for 5 since I can just hit 1 and move right.

Here is the monitor setup and wspy data for each monitor: https://imgur.com/a/lMWasnw

Any idea why it fails?
User avatar
mikeyww
Posts: 26600
Joined: 09 Sep 2014, 18:38

Re: Mouse position headaches with multiple monitors

Post by mikeyww » 17 Apr 2021, 10:47

Code: Select all

CoordMode, Mouse
MouseMove, A_ScreenWidth / 2, A_ScreenHeight / 2
Could also look at SysGet.

Code: Select all

SysGet, mon2, Monitor, 2
CoordMode, Mouse
MouseMove, (mon2Right - mon2Left) / 2, (mon2Bottom - mon2Top) / 2
Post Reply

Return to “Ask for Help (v1)”