Highlight Location Failing to Evaluate

For some reason I can't get the Highlight Location Action to work for me. I keep getting a "Failed to Evaluate" notification error.

If I don't enter X or Y values it works but as soon as I enter any value it fails.

Am I doing anything wrong?



Have you looked at the KM Wiki for MOUSEX function?

I did. Unfortunately I don't understand how it's supposed to work. Why are the numbers I entered red? Maybe that's a good starting point for me to figure out.


The values are in red because MOUSEX() and MOUSEY() are functions that do not take arguments. In other words, remove the "10" and you'll get the X and Y positions of the mouse.

What are you trying to achieve with the "10" values anyway?

I'm simply trying to draw a rectangle in a certain area of the screen. To me the action title "Highlight Rectangle at ..." very clearly implies that the user should be able to tell it where to do it by giving it the coordinates. If that's not how it works them the title is misleading.

That said, how can I achieve this?


The first two values in the action set the top left corner of the rectangle while the next value (your 400) specifies the rectangle’s width and the last value (your 200) specifies the rectangle’s height. The action just highlights that rectangle, so not misleading.

You want to draw a rectangle on the screen? Is that in a drawing app of some sort?

I need to focus attention to a certain part of the screen—that's all. Can't believe it's so tricky to achieve this.

...still don't understand then how to use a "Highlight Rectangle at ..."


OK, so I created a simple macro to test out what you're talking about and here's what I get

I set the display time to 30 seconds so I could do the screen capture. As you can see, the rectangle is drawn starting at the mouse position and is 100 by 100 in size.

So I'm not sure what you're doing differently...

I now see that I have misunderstood how this action works. I thought you could enter a value for each MOUSEX() and MOUSEY() to tell KM where on the screen to draw the rectangle. But it seems you're not supposed to enter anything inside those parenthesis.

Which brings me to another question: What's the purpose for having those two MOUSEX() and MOUSEY() fields then?

And now back to my original question: How can I make KM draw a rectangle on any part of the screen—other than where the mouse pointer is located?


MouseX and MouseY are like variables - they just hold the values of the current mouse position. You do not have to use them if you don’t want!

So, if you want to highlight a rectangle of width 50 and height 75 starting at the point x=123 and y=456 just use the action with the values set to 123, 456, 50 and 75 respectively.

What if I did want to, how would one use these then?

Which action would that be?

It sounds like you’re winding me up. Bye.

1 Like

Sorry. Totally wasn't my intention. I just needed to make sure I completely understand how this particular action works. Which is why I continued asking more questions.

Thank you though.

OK - but I think I'm frustrated that I'm not able to explain properly, so maybe it's time for another to try. Sorry.

Here are two examples that may explain the earlier answers.
MOUSEX and SCREENVISIBLE are built in KM functions and need () after them.
The coords are exactly what is needed to define a rectangle ie
x, y , width and height
Hope the pics make sense

1 Like

Thanks jonathonl. Now I understand. I deleted the MOUSEX and MOUSEY text altogether in the top two fields and simply entered the coordinate numbers and it worked!


1 Like