I created this macro because I am frequently writing code that essentially says, "Do Macro X as long as T amount of time has passed since the last time we called X." Maybe you don't write code this way, but I do. You might find it helpful too, in certain cases, and I will show two examples below that might illustrate some value to you.
There's more than one way to use it. I will describe both ways.
The first way to use it is to simply add it to the top of a macro that you want to limit its execution. For example, here's a way to use it at the top of a macro so that it limits the frequency of the macro to once per 15 minutes, no matter how many times you call or trigger this macro. By inserting this action at the top, you know it will execute a maximum of once per 15 minutes (i.e., it will not perform the SMS action if the previous time it ran was less than 15 minutes ago.)
HOWEVER, for the above action to work you must keep the flag "Failure Aborts Macro" on but turn off "Notify on Failure" (on the Execute Subroutine action.) AND this will only work if this macro triggers itself, rather than is called by another macro. For that situation, you need to exclusively use the next method.
The second method is this: It intentionally returns an error if it is not yet time for the next repetition to occur. And to take advantage of that feature, you use an IF statement to test the %ActionResult% value of the macro. For example, this should work to create warning messages a maximum of once per minute:
HOWEVER for this to work you must turn off both error flags mentioned above, on your call to the macro.
Notice how in the example above, there is an IF statement to detect if the "Periodically Limit Macro" action returns an error, which means that it was not yet time to run the macro. If it returns "OK" then that means you may perform any action. By doing it this way you limit your warning messages for that particular condition to once per minute (or whatever time you specify.)
You could also call this macro a timer. It's important to understand that this macro has an unlimited number of timers, which are based on each Name that you pass to the macro. Each Name is a different timer. There is no limit as to how many timers you can create. (If you haven't used a timer in a week, it will erase it from the Dictionary to save space. This is fine, because nobody is likely to create a timer that limits an action to more than once per week.)
One of the main problems I had in developing this macro is that I wanted to call macros by name, but KM doesn't make it easy to call a macro by name. And although there's a way to do that, it can result in code being more difficult to maintain, so I avoided that solution.
Now I can use this macro in my day-to-day work. Hopefully I don't have any problems with my macro, but if I do, I will post an update on this thread.
Periodically Limit Macro Macro (v11.0.3)