Can Keyboard Maestro Return Mouse to Original Position After Running a Macro?

Hello Everyone

I've created a macro that moves the mouse to perform certain actions. However, I would like the mouse to return to its original position after the macro completes. Actually, I want record the mouse's starting position in a variable, and then after the macro has run its course, use that variable to return the mouse to its original location.

The issue I'm facing is that when I try to use a function to move the mouse position, there doesn't seem to be an option to move it to a variable value.

Has anyone here successfully done this and knows if it is possible to achieve this desired functionality?

Thank you!

Welcome to the KM Forum.

What you’re asking is very straightforward to do. Since I’m away from my Mac I can’t give you an actual macro but I can point you to a page in the KM wiki that tells you how.

Here’s the link: Mouse Positioners [Keyboard Maestro Wiki]

In your macro, the first action should be to save the current mouse position while the last action should be to restore the saved mouse position.

If you have trouble following this just say and I’ll help out when I get back to the office (or maybe some other user will chip in).

2 Likes

Hi and welcome to the forum! :wave:t3:

As you'll soon discover, this form is replete with clever solutions to difficult problems. As such, the first thing you should do when you have a question is to use the search function. More often than not, the answer is only a few clicks away.

2 Likes