If you want to check if a given window exists with AutoIt, you will at least need to know the title of the window, alternatively you can also use the window classname.
If WinExists("[CLASS:Notepad]") Then MsgBox(0, "", "Window exists") EndIf
Waiting for the window to appear
You can also, if needed, use the WinWait function, which allows you to make your script wait for the window to first appear, and create a window handle that you can re-use throughout your script.
$hWnd = WinWait("[CLASS:Notepad]", "", 10) sleep(10000) If WinExists($hWnd) Then MsgBox(0, "", "Window exists") ElseIF MsgBox(0, "", "Window does not exist") EndIf
If the window is closed, and a new window opened, the script will show a message that the original window no longer exists.