Click on saved location, return mouse to position?

Is there an easy way to click at the position saved using "Set Variable 'abcde' to Text %CurrentMouse%" and return the mouse to where it was prior to clicking?

I'm looking for something equivalent to using the variable "abcde" as the "at" location in the Action "Move and Click at ... " with the option "restore mouse location" active.

Of course, "abcde" must be a variable that lists an x,y location. I use "MouseLocation" as the name for this variable, and that is the default (afaict) that comes up when I add the Action "Use Variable ... to set Mouse Location".

The issue I face: Lightroom has a command buried in an unorthodox drop-down menu that is not accessible any other way that I can find. (It's the "Set Poster Frame" in the non-standard video scrub bar drop-down.) My current macros save the location of the drop-down icon to a variable, then, with three Actions, move the mouse cursor there, click, select the command I want, and execute it. I would then like to return the mouse to where it was before executing the command.

The Action "Move and click" can return the mouse, but can't use the saved-variable containing mouse coordinates.

I could, of course, save two mouse locations — the location of the drop-down icon, and the current location of the mouse when I execute the macro that sets the poster frame — and return the mouse cursor that way, but that seems (heh :blush: ) tortuous.

Bonus: Keyboard Maestro does not, afaict, even see Lightroom's video scrub bar. I have tried to use a found image, but the image is never found. Keyboard Maestro either finds nothing, or, with fuzziness set high enough, finds several other things in the Lightroom window (to which I'm limiting the search scope). That Keyboard Maestro doesn't see the video scrub bar isn't surprising: Lightroom does lots of non-standard things, and the scrub bar has at least three states (invisible, visible, expanded) as well as varying in size. Is there any way to allow Keyboard Maestro to find an image for a program control such as that?

1 Like

Sure it can:

image
image

or did I misunderstand what you want?

4 Likes

Thanks — that's perfect. I thought it would be "in" Keyboard Maestro, and (obviously) didn't know how to do it.

:tophat:

1 Like

Trying to adapt these instructions to my own need. Once again feeling the pain of JMichaelTX's death.

In his example above, I see "Click t (Local_Mouse.X,Local_Mouse.Y) from the Absol..." but I can't figure out how to recreate that "Click" action.

My task:
in Application A: Remember mouse position
Go to Application B
Click the mouse at a relative position within Application B's window
Switch back to application A
Replace the mouse position to where it started.

I can't figure out the macro actions to record the current position in a variable, then reset the position to that variable at the end! Any advice?

App Switch Mouse Click.kmmacros (23 KB)

Macro screenshot

Thank you!

After scouring the forums for 45 minutes and then posting my question, I found this built-in solution which fixed my problem: Going to the gear icon in the "click at mouse location" action, and selecting "Restore Mouse Location"!

That's great if you're only doing one mouse move. If you do several in a row, each one will have to restore position. Often, you'll find yourself building a complex macro and then realising you need to restore the mouse position. That's when sticking one action at the beginning and end can be more convenient. For this purpose, I have the store and recall actions saved as one Favourite. When I add it to the end of a macro, both actions appear and I move the first to the beginning.

1 Like

Not that is really matters, but there is a Token to save the current mouse location %CurrentMouse%. No need for %Calculate%MOUSEX()%, %Calculate%MOUSEY()%

6 Likes