Author Topic: Best practice to make mouse movements monitor agnostic?  (Read 925 times)

librarian

  • Newbie
  • *
  • Posts: 15
Best practice to make mouse movements monitor agnostic?
« on: April 03, 2022, 06:48:20 PM »
This might not even be possible but thought I would see if anyone has tackled this issue.

I have a three monitor setup. A netbook screen plugged into a docking station with one landscape and one portrait monitor. I knew this would be an issue and have been ignoring it but I now have to face it because my main ladscape monitor at one of my workstations died and I am having to use the laptop screen.

After realising it would be an issue I started to make many of my mouse commands application window coordinates instead of screen coordinates. This has allowed me to use the same commands on the landscape or portrait monitors, but when I use the laptop screen the resolution is different and there are some issues.

Is there a way to make my mouse movements more monitor/resolution agnostic or best practices anyone has found to minimise issues?

Thanks

Incurable-Rash

  • Full Member
  • ***
  • Posts: 181
Re: Best practice to make mouse movements monitor agnostic?
« Reply #1 on: April 04, 2022, 10:26:54 PM »
does the mouse move coordinates "set point" not work on both monitors, I have 2 monitors but they are the same size and same orientation.

librarian

  • Newbie
  • *
  • Posts: 15
Re: Best practice to make mouse movements monitor agnostic?
« Reply #2 on: April 19, 2022, 05:39:04 PM »
Not sure what you are referring to with "Set Point".

If I set the mouse to move to coordinates based on the screen it is x/y axis pixels, when I use a different resolution monitor those coordinates are different so my mouse moves to a different spot.

Pfeil

  • Global Moderator
  • Hero Member
  • *****
  • Posts: 4782
  • RTFM
Re: Best practice to make mouse movements monitor agnostic?
« Reply #3 on: April 20, 2022, 12:36:33 AM »
Normally I wouldn't expect screen resolution to affect the coordinates of a given point within a window, provided that the window is of identical size, given that a pixel is a pixel, regardless of how many there are on screen.

Unless you're using different scaling settings for these different displays, and/or resizing the window.


If scaling is the issue, you'd need to attempt to work with percentages, by calculating the position relative to the window's size (E.G. using "{ACTIVEWINDOWWIDTH}" and "{ACTIVEWINDOWHEIGHT}")

If the window is actually resized, that may also apply, assuming the various UI elements you're trying to click remain visible and in the same relative position.


I understand from your previous posts that you have no choice but to use mouse movement, but unfortunately this type of thing is the reason why it's considered a last resort.
Mouse movement is intended to be used in a feedback loop where the user visually identifies the elements on screen, and adjusts the cursor position to suit, which is not well-suited to automation.