I use a program at work where there are no controls, all windows have the same name, etc. in my loops where an error box could pop up, I do something like this $search = PixelSearch(465, 213, 845, 273, 0xFF8080)
Do
$search = PixelSearch(465, 213, 845, 273, 0xFF8080)
$pos = WinGetPos("[CLASS:Chimenix]")
If $pos[2] = 422 And $pos[3] = 132 Then;width and height of error box
Sleep(500)
Send("{ENTER}")
ControlSend("AutoItlog", "", 15, "Workflow in use" & " " & @HOUR & ":" & @MIN & @CRLF)
$reason = "In use"
norun()
EndIf
Sleep(10)
Until $search <> 1 *edit* WinGetPos("[CLASS:Chimenix]") <-- this is the same name I get for all windows pertaining to this program but since the window sizes are different, I can tell which is which by the size