wimhek 0 Posted May 16, 2010 Hi I am having troubles with my script. I start up a program, but sometimes is fails. Result is that Autit loops. How can I avoid this. Code is simple (generated) If Not WinActive("ServiceCenter", "") Then WinActivate("ServiceCenter", "") WinWaitActive("ServiceCenter", "") I tried several options, any help would be appreciated. Share this post Link to post Share on other sites
water 2,409 Posted May 16, 2010 (edited) Set a timeout for Winwait like $Result = WinWait("ServiceCenter", "", 10) If $Result = 0 Then msgbox(0,"","ServiceCenter didn't start!") exit Endif If Not WinActive("ServiceCenter", "") Then WinActivate("ServiceCenter", "") WinWaitActive("ServiceCenter", "") This solution has the advantage that your script goes on as soon as ServiceCenter starts up correctly but waits a maximum of 10 seconds if it doesn't. Edited May 16, 2010 by water My UDFs and Tutorials: Spoiler UDFs:Active Directory (NEW 2020-10-10 - Version 1.5.2.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX (NEW 2020-12-15 - Version 1.6.3.1) - Download - General Help & Support - Example Scripts - WikiOutlookEX_GUI (2020-06-27 - Version 1.3.2.0) - DownloadOutlook Tools (2019-07-22 - Version 0.6.0.0) - Download - General Help & Support - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - WikiTask Scheduler (2019-12-03 - Version 1.5.1.0) - Download - General Help & Support - WikiTutorials:ADO - Wiki, WebDriver - Wiki Share this post Link to post Share on other sites
somdcomputerguy 103 Posted May 16, 2010 WinExists - Bruce /*somdcomputerguy */ If you change the way you look at things, the things you look at change. Share this post Link to post Share on other sites