Dim wshshell set wshshell = CreateObject("WScript.Shell") Do If wshshell.AppActivate("Server Busy") Then wshshell.SendKeys("%r") Else If wshshell.AppActivate("TWinCAT System Manager") Then wshshell.SendKeys("%n") bSkip = true End If End If WScript.Sleep(1000) Loop Until Not wshshell.AppActivate("Busy!")