Stop custom command execution immediatetly on key release after key hold

If I bind a custom command to send five to key M and hold it to send multipl ×5 arrow ▼ keys, and then release M, DOpus doesn't stop right away, but still sends a few batches of .
Is there a way to make it stop execution of the buffered commands immediately on key up, just discarding whatever hasn't been executed yet?

Only way I can think of is to add a check to your script so it doesn’t do anything if the key isn’t still down.

How would I do that? Only found this key tracking KeyDown [Directory Opus Manual] reference, but it's not JScript

Opus itself only has ways to test if a qualifier key is down (Ctrl, Shift, Alt, Windows). There may be a way to do it for other keys via the Windows scripting objects, although it's not something I've ever done before and I can't find a way after a quick search.

That's fine, I don't need qualifiers, I'm using single keys (and Shift is handled earlier since it triggers a function with a different argument), so I just need a way to test whether the alpha command triggering M is down.

That would make the command harder to use as you'd need to edit the keybind in the script (or maybe add it as an explicit argument) when you change your key bindings, but if it makes commands behave like regular commands like ▲▼ that would be worth it...

By the way, I have the same issue with DOpus internal commands, for example, if bind tab switch go tabselect -1 to 1, then holding this key buffers and after releasing the key I still get many tab switches

But interestingly enough, if I bind the same command to Ctrl+1, I don't get many buffers (maybe one at most). Is there a way to make at least internal commands behave properly?

No, there's nothing "improper" there, it just doesn't work like that.