WinWaitActive, Test, Test, 6 ; Wait 6 secs for window to appear if not ErrorLevel ;Window is found and it is active { ControlFocus, OK, Test ; Send focus to 'OK' button if not ErrorLevel { SendInput, {ENTER} ; We know for sure where do we send Enter OutputDebug, OK!!!'n MsgBox Success! } else { WinGetTitle, title, A OutputDebug, FAILED: Failed to focus 'OK' button. Active window caption: '%title%'.`n } } else { MsgBox Problem with window focus! } return