There are two ways you can avoid this problem. To decide which to use, find out whether your host sends another screen after processing the logoff, or disconnects the session without sending another screen.
screenDesc.Clear(); screenDesc.AddCursorPos(20,16); ps.WaitForScreen(screenDesc,10000); ps.SendKeys("logoff[enter]"); waitForConnection(ECLConnection.CONNECTION_INACTIVE);
When the Disconnect macro contains the waitForConnection(ECLConnection.CONNECTION_INACTIVE); macro command, Host Publisher waits after playing the Disconnect macro for the host to disconnect the session, allowing the logoff to complete. If the host does not disconnect the session within a short time, Host Publisher disconnects it.