Is there a way to get the result of which modifier key was pressed that let a "pause until modifiers pressed" action complete? If there is, my search fu has failed me and I apologize.
I'm using something similar to the technique described here: Testing which modifier keys are pressed… A simple way of modifying the actions of your macro by adding the OPT key when you call it to detect which modifier key was pressed, but anyone who has worked with real-time systems knows this technique has a race condition. In my case I have a pause until one of the modifiers is pressed and then a check on which one is currently pressed.
This works well the majority of the time but often fails when the system has a high CPU load, like during backups or running HandBrake. In that case, I press and release the control key but because there is a longer delay in executing the second action than it takes me to release the control key, the macro doesn't see the key still down and executes the else clause thinking it was the shift key.
The workaround is to try and remember to press and hold the control key for a longer period of time, but muscle memory defeats me because the macro works the vast majority of the time.
I suppose I could detect that no modifiers were down and prompt myself to try again and hold the key longer, but that's a kludge.
I really need to be able to query the result of the previous action to know which key enabled the action to get out of the pause. I suspect this is not trivial due to the large number of conditions that the pause action allows. Anyone have any brilliant suggestions?