This involves MIDI triggers. The macro (Macro 1) being triggered by a specific MIDI message(s) then subsequently sends a different set of MIDI update messages back out of KM to my DAW. This outgoing MIDI message tells the DAW to then send a subsequent SYSEX message (these are used for displaying characters for names) out to KM. I then use a different macro (Macro 2) in KM to translate this SYSEX message, via a look up table and shell scripts, and ultimately send it to a "Set Stream Deck Title" action, which then updates the buttons on my Stream Deck, This is all essentially happening in real time.
MIDI Trigger (Trigger A, Trigger B, etc.) > Macro 1 > MIDI Update Message > DAW > SYSEX Message > Macro 2 > Stream Deck
It's a bit circuitous. That's why I didn't mention all of this before. In addition to all of this, Macro 1 also directly enables/disables Macro 2, to act as a gatekeeper for when it can or can't accept MIDI messages. It's a bit complicated, but it DOES all work. The only issue that arises is if too many MIDI message triggers come into Macro 1 at once.
In any case, Macro 1 is what I'm concerned with. Given that multiple MIDI message triggers can come in quickly, in a very short period of time, I don't want multiple instances of Macro 1 all running at the same time because, if they are, they will cause issues with the translation going on in Macro 2, as described above.
So, is there a way to always cancel all instances of Macro 1 except for the most recent one? Basically, any time any one of the triggers for Macro 1 starts a new instance of Macro 1, I want all previous instances of Macro 1, that may be still running, to cancel. In a lot of cases, the previous instance of Macro 1 will have already completed, and it won't matter but, for those cases where one or more instances of Macro 1 are still running, I want to cancel all of them, except for the newest instance that just got triggered.
Since every new instance would cancel the previous instance, I basically just need it to cancel the previous instance because, even if 10 triggers all happened closely together in time, iinstance 2 would cancel instance 1, instance 3 would cancel instance 2, instance 4 would cancel instance 3, and so on and so forth.