Okay, you were right, closewindow only minimizes the window. So again, a new attempt:
I've added some delay and safety so the computer doesn't hang when nothing is found:
I've added some delay and safety so the computer doesn't hang when nothing is found:
ExecFile "Calc.exe" windowname$ = Input("Please enter window title >") find = 0 While find = 0 find = api_FindWindow%(0, windowname$) Delay 200 c = c + 1 Write "." If c > 15 Then Exit Wend If find = 0 Then Print "Window was not found..": WaitKey(): End Write "found:" + find api_PostMessage(find, $10, 0, 0) RuntimeError "Ok!"