Mouse Position, How?

Hello, I am still on KM 5.3.2, expect to upgrade soon. I am using mouse position but, how can I tell where that is? I accidentally hit a key combination earlier today that started a recording macro in KM. If I could remember how I triggered that, perhaps It wold tell me what I Want by recording where I Clicked?

ADDED: RE-discovered Record-Macro but was hoping running that would record my clicks and tell me where i had clicked. Seem I cant find any output for that macro yet?

Thanks

It’s relatively easy. You can get the mouse position from a calculation. Here I use a highlight action.

Highlight Oval at MOUSEX(),MOUSEY(),200,100

I have been using “Highlight Location” and “Move and Click Mouse” as a trial and error method. It’s completely trial and error and therefore cumbersome and time consuming.

Your suggestion seems the same thing as what “Highlight Location” does. What I am looking for is a way to 1) set a window to a certain size like my calendar when It opens (I have done this) and 2) to click on a day or week or month button, or click on an advance a day or revert a week arrow, etc. To do that I need to understand precisely where those buttons are on my screen.

I may also want to click on a menu location for an app, then click on the menu selection exactly where that menu Item appears when the menu drops.

Is there a way to do this with KM?

Thanks

Hey @levelbest,

Yes. That's a PITA.

Look here: How count pixels to place the cursor properly?

Remember that KM can directly access most menu items and many buttons.

KM Actions:

Select or Show a Menu Item

Press a Button

--
Best Regards,
Chris

To click on a button, you can either click relative to the window or relative to a found image.

To find the relative coordinates of the button in the window, the easiest way (for everyone except me anyway) is to use the screencapture command, Command-Control-Shfit-4, and then draw a rectangle from the corner of the menu to the button - screencapture will show you the coordinates, and then you can press escape and then enter those coordinates, relative to the appropriate corner of the window (remembering that coordinates are positive to the right and down, regardless of which corner of the window you use).

Alternatively, you can click relative to a found image to find the button. To click relative to an image, you use the Mouse Click action, configure it to be relative to a found image, and take a screenshot of the desired area of the screen using Command-Control-Shift-4, and paste it into the image well on the action. The image has to be unique (which includes not being visible in the action if the image is small enough not to be shrunk in the image well) otherwise Keyboard Maestro will not know where to click. The Display option in the action will allow you to see where Keyboard Maestro is matching.

Selecting from a popup menu is best done by first clicking, and then after a short pause, followed by Insert Text by Typing “Menu Name%Return%”

[quote=“ccstone, post:4, topic:1077”]
Look here: How count pixels to place the cursor properly?
[/quote]I love It! Thanks so much for the link. I know I tend to think a little bit differently, but now I have a macro for looking at my calendar that I like. It opens iCal (Calendar), sizes the window as I like It, then uses the click on coordinate method to;

• Open week view
• Go to Today
• Pause 7 seconds
• Right arrow to look at next week
• Pause 7 seconds
• Click on day view
• Click on today
• Click on the search field just in case I Wanted more information on an event

Yippee.

[quote=“peternlewis, post:5, topic:1077”]
To find the relative coordinates of the button in the window, the easiest way (for everyone except me anyway) is to use the screencapture command, Command-Control-Shfit-4, and then draw a rectangle from the corner of the menu to the button - screencapture will show you the coordinates, and then you can press escape and then enter those coordinates, relative to the appropriate corner of the window (remembering that coordinates are positive to the right and down, regardless of which corner of the window you use).
[/quote]Thank you for your suggestion, I would not have thought of using the screen rectangle method. I have an app named Panorama by Provue. I know that program can do all sorts of tricks and showing screen coordinates is one of them. But, I like simple and easy to remember over complex and hard to remember. The recent suggestion of using your software and a kind users suggestion to put in the following code works very well. Not only will It find the mouse location with a hot key, It leaves the results open for copy and paste of for looking at while I put in the correct values in my KM script. As the Germans say, das ist wunderbar!!!

Screen: → %Calculate%MOUSEX()% / ↓ %Calculate%MOUSEY()% / ← %Calculate%MOUSEX()-SCREEN(1,Right)% / ↑ %Calculate%MOUSEY() - SCREEN(1, Bottom)%
Window: → %Calculate%MOUSEX()-WINDOW(1,Left)% / ↓ %Calculate%MOUSEY()-WINDOW(1,Top)% / ← %Calculate%MOUSEX()-WINDOW(1,Right)% / ↑ %Calculate%MOUSEY()-WINDOW(1,Bottom)%

Thanks again for a great piece of software.

David