How to detect that a "temporary dialog window" appeared, and to continue macro when it vanished?

Hi! With Ableton Live, I already have a pretty nicely functioning "Freeze then Flatten" shortcut made with KM. Really happy with it. But this only works for really quick freezes, i.e. if it takes about 1.5 seconds to freeze, then it will wait for 1.5 seconds and then continue to flatten.

Without wanting to increase the delay between Freeze and Flatten, is there a way to go "ok, "Freezing..." dialog appeared.. wait... ok, now the "Freezing..." dialog vanished -> immediately trigger Flatten shortcut?

Solved it. "Pause Until Conditions are Met" -> "Any window title of:" "Freeze..." = yes, and then a second pause for "Freeze..." = no.

Works! This is so crazy.

err i have no idea why "escape" is selected as the shortcut. i needed some way of getting keyboard focus away. i of course use shift-cmd-F to freeze+flatten.