Dim wshshell set wshshell = CreateObject("WScript.Shell") Do If wshshell.AppActivate("Server Busy") Then wshshell.SendKeys("%r") bSkip = true End If If wshshell.AppActivate("TwinCAT PLC Control") And Not bSkip Then WScript.Sleep(20000) If wshshell.AppActivate("TwinCAT PLC Control") And Not bSkip Then wshshell.SendKeys("{Enter}") End If End If WScript.Sleep(1000) Loop Until Not wshshell.AppActivate("Busy!")