Mapping a Keyboard Maestro Macro to a Logitech Mouse Button?

Sorry for what is almost certainly a totally ignorant query, but here goes:

I have a Logitech mouse (Signature M650 L LeftHanded).

Using Logi Options+.app I can map two keystrokes to the two buttons on the mouse. I chose the Delete key and Command-A.

But what I would ideally like to do is to map these two mouse buttons to two specific macros in KM (v 10.2) running in OS 13.4.

I'm sure I'm missing something totally basic, but how do I do this?

Many thanks!

You can see if Keyboard Maestro can detect the button presses with the USB Device Key trigger. If so, you're all set.

If not, then you can either:

  • Uninstall (completely!) the Logitech software, so that there is no driver for the mouse, and then Keyboard Maestro might be able to detect the buttons, or
  • Configure the buttons to keys you will never accidentally press (like Control-Command-Shift-P and L), and then use those as keys for your Hot Key triggered macro.

Thank you very much! Your option #2 worked like a charm :blush:

I had tried this before without success, but I think I had used "Insert Text by Pasting or Typing" rather than via “Type a Keystroke”. The latter worked flawlessly. I am new to KM and computers so am likely making many dumb mistakes.

Again, I greatly appreciate this program and your patient help!

im using the option #2 scenario as well. I wonder if we can combine triggers than?
i configure a mouse button to perform {ctrl + alt + cmd + 0}. that perfectly triggers an action. now I would like to press the mouse button and the shift modifiers to trigger another but related action. I that possible and how?

Based on a quick test with my Logitech, you can do this by setting multiple triggers for the macro, and then branching based on the presence of the Shift key indicator in the trigger value. Here's a very simple macro to demonstrate:

Logitech Test Macro (v11.0.3)

Logitech Test.kmmacros (5.3 KB)

Assign a button on your mouse to send Control-Option-J, then click that mouse button. Try again while holding the Shift key down. You should see two different onscreen messages.

-rob.

3 Likes

thanks for taking the time rob! i followed all the steps but this macro always executes the otherwise action and displays "Macro ran!".

Even though the shift sign is entered in the contains field, I couldn´t found shift in the contains pop up menu…?

Just in case it matters: i have KM 10.2 running on a mbp M1 pro monterey machine and use a mx master 2s and one of those white standard wired apple keyboards…
maybe something needs to be set on system or km side.

I tried something similar and this method returns at least sometimes the right (shift) action, but its very unstable:

Logitech Test1.kmmacros (5.2 KB)

I don't know what to say: Your test macro works perfectly here with my mouse. I'm using KM 11 on a Mac Studio, with a Logitech keyboard and mouse—perhaps that's the key difference? (See what I did there? :)).

But it really shouldn't matter—a Shift key is a Shift key, regardless of the source. So I'm back to stumped.

-rob.

really, hmm that´s strange. i can try a different keyboard and mouse but as you said it shouldnt make a difference.
i have a somehow similar problem where shift and streamdeck triggers not getting tracked correctly:

@peternlewis, i wonder if this both happens due to a odd system/keybaord maestro constellation/configuration?

Iam grateful for any hint.

Which turned out to be when you pressed your "modifier" button then waited 1-2 seconds before pressing the trigger button, rather than pressing both near-simultaneously.

So what exactly are you doing here? Tapping the Shift key then clicking the mouse button? Holding down the Shift key while clicking the mouse button? Something else?

1 Like

This is not the right way of doing this.

Base your If condition on the trigger (%TriggerValue% token in this case) rather than the state of the modifier keys, otherwise at the least you have a timing issue involved (if you press Shift-Option-Control-J and release the Shift key it would do the wrong thing).

1 Like

Ok, if I understand you right, that’s exactly the way how @griffman is doing it: Mapping a Keyboard Maestro Macro to a Logitech Mouse Button? - #5 by griffman
But for me this doesn´t work at all. It will always execute the otherwise action within the if action, hence it wont recognize the shift-modifier.

@Nige_S doing it the way that @griffman mentioned above, it doesn’t matter how long I wait until I click the mouse button after I pressed shift on my keyboard. It will always fail even if i click close to simultaneous.
I normally click and hold shift wait half a sec and than press the mouse button (additionally).

Yes, with my other macro it wont work if i wait longer than a second. It works better with shorter intervals between shift and Macro button on the streamdeck but still not 100% stable.

Let me know if you need more details… Thanks for your help guys!

The hardware keys and simulate keys are not the same. So holding the Shift key and simulating a Control-Option-J will not generate a Shift-Control-Option-J, and indeed if the software is well behaved, it will actively have removed the Shift key modifier from the system despite it still being physically pressed.

The only way that would work would be if the Logitech software let you specify the key to simulate taking in to account the modifiers held (ie, no modifiers, simulate Control-Option-J, Shift modifier, simulate Control-Option-Shift-J).

1 Like

well, it seems that using Logi Options+ instead of Logi Options solved the problem. @griffman since you are using a logitech keyboard i guess that you are using logi options+ as well, is that right?

Oh jeez, I didn't even realize non-plus was still available! My apologies. Yes, I am using Logi Options+. Glad you figured that out!

So I guess that means Logi Options+ is badly behaved, but I'm thankful for that. You can assign a hot key in Logi Options+ (without a Shift key) to a mouse button, and then, when you hold Shift and click that mouse button, Keyboard Maestro sees Shift and the hot key combo.

-rob.