Can I Capture the Mouse Location and Store It on the Fly on a Button?

I wonder if there is a way to capture constantly the Mouse position in the screen...

I am working and I use different tools (Plugins)

so with my mouse wheel i change the values of a parameter (Knob in the GUI of a plug in).

Lets say I always tweak Frequency and Gain parameters where each have a knob, but I use different plug ins in a session.

So I want to toggle between those 2 parameters or knobs and adjust their values until I am happy

So I open a Plugin A and move the cursor or mouse over parameter 1 (type a command for ex "Command 1" ) and that XY location is stored directly in Button 1 on my mouse then I go to Parameter or Knob 2 in the Plug in and repeat the same, this time I type c "Command 2 or apple 2" again the location is stored in mouse button then i can toggle the mouse cursor location between those two knobs and adjust their values with my mouse wheel.

So being able to store locations temporarily will allow me to open different plugins and toggle between parameter knobs and change values quickly...

***** now, I do not know if the best way to SAVE each location is thru a command like "Command 1" (or apple 1) or just press or assign buttons to store that function

So having this idea what will be your strategy, advise or way to achieve this??
Is that possible with Keyboard Maestro?


Hi Reuven,

This is definitely possible. First, you would need two simple macros to capture the first and second mouse locations:

Save Mouse Location 1.kmmacros (1.7 KB)
41 AM
Save Mouse Location 2.kmmacros (1.7 KB)
45 AM

And two corresponding macros that use the captured mouse locations to set the cursor:

Restore Mouse Location 1.kmmacros (1.1 KB)
49 AM
Restore Mouse Location 2.kmmacros (1.1 KB)
57 AM

For the latter two macros, use the USB Device Key trigger to assign each macro to the corresponding mouse button (assuming it's a non-Apple multi-button one, which it sounds like it is).

While I've used Command-1 and Command-2 to trigger the macros used to save the mouse location, I can't tell you if that's the best way or not; that's something you need to experiment with to determine for yourself. If your mouse has enough buttons, you might prefer using two of those for the location saving macros as well, but it's really up to you.

One last note: macros like these should almost certainly be kept in a macro group that is specific to the app(s) that you're working in, otherwise they're bound to interfere and cause your mouse and shortcuts to behave in ways you don't want in other apps.

Good luck, and feel free to post again with any further questions!

Wow, THANK YOU SO MUCH!! I am floored by your great help!

1 Like

I am trying to see if Keyboard maestro can do more than Controllermate so to start…

So can Keyboard Maestro receive input from TouchOSC and other Peripherals (mouses, Midi, potentiometers etc, etc )

Unfortunately I’m not familiar enough with TouchOSC peripherals or potentiometers to comment on them, but I do know that KM supports many devices through the aforementioned USB Device Key trigger, and it does indeed have support for MIDI input.

I hope they can support Touch OSC, I may need to investigate


I tried what you gave me and works!! thanks so much…

I was trying to modify the “Save” location that instead of Command 1 to use Double click button 1 … but gets in a way of actually the “Restore” Location 1… no idea if there is a tricky way to do this as is 1 click of the same button to “restore” that location

so I was trying to sue Command Button 1 to “Save” location 1 …but I do not find a way to do it…tried a couple of methods and failed


I tried and works with TouchOSC :slight_smile:

1 Like

You're welcome! As you've found, you can't easily set one button to do double macro duty like this with clicks alone, but one way you might be able to do this relatively easily is to have the save macros use a button click in combination with a modifier key, like Option:

and use a standard button press for the restore macros:


1 Like

Touch OSC is used as a demo in the What’s New video, about 1:30 in:

1 Like

Thanks again…this is what I did but with Command Click…but seems that do not catch the Modifier …tried it with Option Click …also the same interference… :frowning:

maybe because in the order the click is first???

I do not know if this is crazy but I could do it l this way..but maybe is redundant somewhere? 40 PM

I'm afraid that won't work; that setup will make both buttons trigger the macro, as opposed to only triggering it if both are pressed at the same time. Fortunately, I think I found a way to make the modifier button work in combination with the mouse click after all:

Save:Restore Mouse Location 1.kmmacros (3.4 KB)
59 AM
Save:Restore Mouse Location 2.kmmacros (3.4 KB)
22 AM

Change the triggers to the mouse buttons you want to use and see if these don't work for you.

1 Like


You are a genius!!!

1 Like