Cubase macros do not test for conditions. Quickeys can see windows and has functions like “Wait for Window with name containing” and “If frontmost windos is [named | type]” etc.
I’m happy to share… I’ll start a different thread… it’ll take a bit of time to compose something.