How do I click and hold (at the mouse's current position), and then drag to and release at the position of a found image?

I hope what I'm asking makes sense. Let me know if any clarification is needed.

you have some options

Thanks, @hello. I'm aware of that option, but wouldn't that only accomplish click and hold? I need it to then subsequently drag to the found image (while still holding) and release.

Did you look at the Move or Click Mouse action?



Hi, @JMichaelTX. This is what I had set up, that's not working...

Any idea what I'm doing wrong?

This works for me:


Adjust image and coordinates as needed.

This also works:


1 Like

Works here, too. Thank you, @JMichaelTX!

Semi-related to this, is there any way to store the mouse's current location so that it can be returned to several steps later?

1 Like

set variables
and call them later

1 Like

saved current location and returned.kmmacros (1.6 KB)


Instead of the "Calculate" token, you can use the %CurrentMouse% token.

If you set the KM Variable "Local__CurrentMouse" to %CurrentMouse%, it contains the X,Y position of the Mouse. Later if you just need one coordinate, you can use notations like this in a numeric field:


@JMichaelTX, @guxianbang, and @hello, many thanks here! I've got things working on my end.

1 Like

I am looking for an answer to a slightly different flavour of this question: how do I hold the mouse POSITION for a certain amount of time?

Hey Alex,

You mean LOCK the mouse into a specific position?

You can't. The best you can do is loop and move the mouse back to a specific position if it has moved.


1 Like

Yes exactly. Thanks! Shame, but I can see how such a tool could create complications in the wrong hands

Keyboard Maestro would have to act as a mouse-driver, and it's not that low-level.

@splitpersonality I think you can do that with cliclick

With what command?

the command


waits N ms for the previous command

This just waits to execute the next cliclick command – it does not lock the cursor in place as Alex wants.


Thanks, just re-read the documentation and lock in position is not supported.
Also realized you already had suggested what I was going to comment (loop in specific position)!