while 1 Run("notepad.exe") Local $hWnd = WinWait("[CLASS:Notepad]", "", 10) WinSetState($hWnd, "", @SW_MINIMIZE) Sleep(2000) WinSetState($hWnd, "", @SW_MAXIMIZE) Sleep(2000) WinClose($hWnd) wend