Using mouse display window to get window specific locations

I want to place a pause condition based on the color of a certain location of a window. I had hoped to use Mouse Display Window to find the window-specific coordinates for that location. However, no matter which circle I click in the window to indicate scope for the coordinates, the coordinates change depending on where the window is located. How do I specify that I want coordinates based on the window itself, not on screen location? Also, how do I copy the coordinates that are shown, and how do I freeze them? Thanks.

OK, I got my answer about clicking and waiting 5 seconds to freeze the coordinates from the general documentation. So now I just need help with limiting the scope of references for coordinates.

The Screen Contains Condition have numeric fields, which will accept functions and numeric tokens. So you could do something like this:

Thanks. Yes, but won’t the Mouse Display Window get those precise coordinates for me?

You said:

So that is what I posted in my above post.

The "Mouse Display Window" is just for a visual display. It is not a function that returns data. But if that is what you want you can use the MOUSEX() and MOUSEY() functions:

You may want to explore the Functions (KM Wiki) article.

Thanks. I meant to be asking how to ask the mouse display window to provide x and y relative to the window rather than to the display, but I didn’t realize that the mouse display window doesn’t do that until you set me straight. Still, you entered numeric values into your example. Did KM provide those for you? If not, how did you get them?

The Mouse Display can show coordinates relative to any corner of the main screen or the front window depending on the selected corner in the screen/window on the left of the Mouse Display.

You can click the lock button and the coordinates will lock five seconds later.

You can click the clipboard icons to copy either coordinate.

2 Likes

Thanks. It depends on what kind of window the front window is, I guess. For example, if you open System Preferences, click the Security & Privacy prefpane, then click the lock, the values displayed for the password dialog when corner selection in the Mouse Display Window is as shown in the screen photo you included doesn’t seem to follow the description you provided.

I lost lock on why you want to use the Mouse Display Window.
How to you want to use the mouse data?

The MOUSEX() and MOUSEY() functions return the same data that the Mouse Display window shows.

###Determine Location of Area to Search for Found Image
If you are trying to determine the location of the color relative to the window it is in, just use the macOS screencapture tool to capture a region, ⌘⌃⇧4, and drag the mouse from the top left of the window to the center of the color area. Before you release the mouse button, note the coordinates shown.

###Using Mac ScreenCapture Tool
(⌘⌃⇧4)

####First Get the width and height of the area you want to search:

So, width=105, height = 100

####Now Get the Relative Distance from the Top,Left of the Window:

So, X=84, Y=320

####Now Use that data in the Screen Conditions of the Pause Until Action:

Does that make sense?

2 Likes

Keyboard Maestro only looks for and sees windows in the front application. And the Password dialog is not actually part of the front application, it is part of its own special application. So you wont be able to deal with it as a window like that.

[quote="peternlewis, post:10, topic:7112"]So you wont be able to deal with it as a window like that.
[/quote]

Thanks. I have it now, I think. I guess it was just my luck to be working with a window that throws the Mouse Display window a curve.