If/Then after 5 seconds

I'm trying to create an if/then based on elapsed time since an palette selection.

User clicks on a palette item
If user clicks item again < 5 seconds, do 'A'
If user clicks item again > 5 seconds, do 'B'

If that's not possible, it might also work replacing 5 seconds with 5 mouse clicks and/or keystrokes.

Any thoughts?

So, assuming that when the "user clicks item" he/she is running the same Macro, then this should get you started.
You should change the "MyMacro" in the KM Variable "DND__MyMacro_LastRun" to some 2-4 characters that uniquely identify your macro. This variable MUST be unique for every Macro that you want to use this approach in.

For example, if I wanted this specifically for this example macro, I might use this:
where "TLMR" stands for "Test Last Macro Run",
and "DND" stands for "Do Not Delete".

Below is just an example written in response to your request. You will need to use as an example and/or change to meet your workflow automation needs.

Please let us know if it meets your needs.


MACRO:   How To Test for Last Macro Run [Example]

-~~~ VER: 1.0    2020-06-24 ~~~
Requires: KM 8.2.4+   macOS 10.11 (El Capitan)+
(Macro was written & tested using KM 9.0+ on macOS 10.14.5 (Mojave))

DOWNLOAD Macro File:

How To Test for Last Macro Run [Example].kmmacros
Note: This Macro was uploaded in a DISABLED state. You must enable before it can be triggered.

1 Like

This is great - thanks
I managed to find the NOW() earlier today.
(That's a rather metaphysical sentence)
Very similar solution to what you have suggested.


1 Like