VBS sample: Clear the scrollback buffer and write the result of serial commands to a file

Sub Main

xsh.Screen.Synchronous = true

' Clear current screen and the terminal's scrollback buffer
xsh.Screen.Send "reset"
xsh.Screen.Send VbCr
xsh.Session.Sleep 100

' start logging
xsh.Session.LogFilePath = "d:\result\1.txt"
xsh.Session.StartLog
xsh.Session.Sleep 100

' Send commands to the server
xsh.Screen.Send "ls -l"&vbcr
xsh.Session.Sleep 100
xsh.Screen.Send "cd ~"&vbcr
xsh.Screen.Send "ls -l"&vbcr
xsh.Screen.Synchronous = false

' Stop logging
xsh.Session.StopLog
End sub