If you have different possible windows that could pop up you could have your "Adlib" loop constantly checking the "title" of the active window with this AutoItX command:

code:
$variable=$oAutoIt.WinGetActiveTitle()