View Single Post
Old 08-06-2019, 08:42 AM
bgagnon bgagnon is offline
VanDyke Technical Support
Join Date: Oct 2008
Posts: 4,395
Hi CAPflyboy,

Originally with your script (edited a bit to fit my environment), I got the same results as you reported. But after a few tweaks, it runs the same with or without the MsgBox(). The presence of the MsgBox() should not change the results, but what it does is if your script is out of sync, it allows it to get back in sync, so I think that's what you were seeing.

The major changes I made were:
  • Reduced the number of times you set Synchronous to True/False. You should set it True after the connection line in ConnectSession() function and then to False in the ExitSession() function.

  • In the ExecuteCommands() function, there are numerous occasions where you don't follow the best practice described in the scripting manual (section 4.2) that there should be a WaitForString() following each Send() command. And for sure you want to uncomment this line:
        crt.Screen.WaitForString "EDT"
  • Lastly, changed ExitSession():
        crtSc.Send "logo"
        crtSc.WaitForString "logo"
        crtSc.Send vbCr
        crtSc.synchronous = False
            crt.Sleep 25
        Loop While crt.Session.Connected

VanDyke Software
Technical Support
(505) 332-5730
Reply With Quote