Trouble getting mouse location in 8.0.4

I'm in this action:

I click the "Get", see the "5", then switch applications, open a contextual menu, and position my cursor over one of the menu choice using the mouse. After I'm sure 5 seconds have elapsed, I go back to KM, but the position is still 0, 0. I can use a different way to find it, because the macro I'm using works fine, but I just wondered what I'm doing wrong. The app for the macro is Microsoft Outlook.

While I'm at it, I guess I should just ask about how to trigger a contextual menu item once the menu is displayed, and/or how to get the menu to appear other than using right-click if the cursor is already placed or if it isn't. I noticed in release notes for KM 7 that a Contextual menu action was added, but a search for "contextual" it in the actions sheet in 8.0.4 didn't get a hit. I've already been warned about activating older versions temporarily. Thanks.

I don’t understand this.

Use an Insert Text action. Example (including the right-click action):

You don’t have to type out the whole string. Type just enough to make it unique and to select the menu item. But this will depend on the other menu items. Using the above example in TextEdit it is sufficient to type p\n.

I'll work with this, thanks. The "5" replaces "Get" on the button in 8.0.4 when you click it, then counts down.

Great! Post again when the next problem/question hits you.

This may no longer be germane to the crux of your question, but for the sake of completeness, I thought I would answer why this was happening. Your clicking action is set to click relative to the current mouse position, which means that when you use the "Get" button to retrieve the mouse's current coordinates, that position will always be 0,0 by default (after all, no matter where the mouse is on the screen, its position will always be 0,0 compared to itself). In the future, just make sure that the clicking action is set to be relative something else on the screen (screen corner, front app window corner, etc.) and you'll then get a different set of coordinates.

While I'm at it, one other tip with using this action: if you have your Mac's sound turned up, you can hear the timer count down from 5 as well as hear it make a different sound when it reaches 0 and records the mouse's position, so you don't need to wait and estimate when 5 seconds have passed entirely on your own. I hope this helps in future use cases!

2 Likes

Note that Keyboard Maestro records all that information, so that you can switch the "relative to" menu after doing the Get, and the coordinates will be changed to match (assuming you haven't changed them yourself first. The recorded information is not saved permanently , but certainly you can change it after the recording and still get the results you want.

1 Like

When I used “absolute”, then changed as you instructed, horizontal values were correct, but vertical values were greater than desired by a value of 20. I wonder if this could be due to some property of Microsoft Outlook. I’ll probably use Tom’s suggestion, because it might provide for more flexibility in case of interface changes.

Keep in mind that absolute is relative to the top left corner of the main screen.

A simple test would be to change the action to "Just Move" and click Try and see where the mouse ends up.