Press and hold device key trigger

I have a 5 buttons mouse, there is a 4th mouse button I used most frequently.

I want to use this 4th button to act as:

  1. if I press the button within a short time (1s), it will type “cmd+v”.
  2. if the button is pressed longer than 1s, it will type “cmd+shift+v”.
    cmd+shift+v is a hotkey to use my clipboard manger.

In keyboard maestro, there is no press delay option, is there a way to write macro simulating this behavior? I am new here, I know some “if else” magic can do the job, but the condition is hard for to me to write.

I also hope keyboard maestro will add a hold device key trigger in the future. This trigger will make multiple buttons mouses and joysticks more useful. I use a windows joystick application named “joytokey” can do such thing easily.

Please look at this article here. Maybe the macro from @Tom you can help.

If you don't mind waiting for 1s to paste every time you invoke this macro, this example should get you started. Just assign it the appropriate device trigger, and make sure the correct mouse button is chosen in the If Then Else action:

Example Macro.kmmacros (2.3 KB)
35 PM

1 Like

Thank you, this works. I like to set the delay set to 0.5s. Some minor bugs exist, maybe down and released events also have some default delays.

You’re welcome, and no problem at all with changing the delay. If you’re seeing buggy behavior, and you can consistently reproduce it, don’t be afraid to make a new topic here reporting it. KM’s developer, @peternlewis, is admirably responsive to feedback, and many past KM bugs, along with new KM features, have been fixed/added as a direct result of bug reports and feature requests made here.