Search in Area doesn't seem to like starting with a negative X value


When designating a place to click the mouse, Keyboard Maestro is OK with a starting X coordinate with a negative value to indicate a distance from the right edge of screen, but this techniques does not seem to work when designating an Area to search for an image.

For example the center of the Close button in a Mac Alert dialog is at [-58, 58], or 58 pixels left from the right edge of the screen, and down 58 pixels from the top. A macro clicking at those coordinates does exactly what is expected. However, if I want KM to look for the Close button to be present in the upper right corner of the screen - say an area 100 pixels wide and 80 pixels high from the top right corner - it does not work to specify coordinates of [-100, 0, 100, 80]. It won't find it. If I put in the coordinates [0, 0, 3000, 80] it finds the button because it is searching a strip along the entire top of the screen.

Is this expected behavior? Is there another way to specify an Area from the right edge of the screen?

thanks, - eric

A negative screen coordinate is not from the right edge of anything.

Clicking can be relative to the main screen, to the front window, or current mouse location, or absolute position (which is relative to the top left corner of the main screen). The main screen is the screen with the menu bar in the Display system preference.

What specifically is the action? The “relative” is set in the action:

A negative coordinate just means left from there. For example, -1 is always two pixels left of 1.

What close button is in the top right corner of the window?

If you want to focus on the top right corner of the front window, you can use:


See: WINDOW function.

Persistent Mac Alert boxes are in the upper right, and are often in multiples. I can't use click on found image because there can be many. I have found a nice AppleScript to close these, so my current need has been solved. I'll look at the Window function.