Ignore triggers within 5 seconds (buffer)

I try to build a log of my apps usage replacing my previous app "Time Sink" that is not reliable enough.
There's one thing I can't resolve: double entries.
My trigger is (among others) the "focused window title changes".
In my browser (Vivaldi), some pages take a while to load and set the window title after loading the page again.
My idea is to "buffer" the trigger for 5 seconds (this would allow the page to load).
All of Vivaldi's window title changes within 5 seconds should be ignored.
A simple "pause" queues the trigger and I get double or even tripple entries.
Yes, I could set a timestamp and compare and reset. Is there may be a simpler way?

You can't ignore a trigger. Each trigger event creates and executes a new instance of your macro, and those instances run concurrently.

But you can add a "Semaphore Lock" action so that your macro only executes one instance at a time, so you now have a queue of instances where each is waiting for the previous instance to complete before continuing its execution.

You then set a short timeout on the semaphore lock so any queued instance quickly aborts, having done nothing.

So keep your 5 second pause, but start your macro with a "Semaphore Lock" and set the timeout option:

...to an appropriate period, and turn off "Notify" so you don't get any alerts about the cancellation:

3 Likes

Thank you, that did the trick!