Hello Tom,
yes, you can use the SendToServer
method (actually it is the only reliable method), but you have to handle client-server communication process. It means you cannot just call the method five times in sequence, otherwise you encounter sync problem (the server is not capable of receiving so many keystrokes in such rapid way). You have to send one carriage return or tab, then wait for the server response (cursor move or prompt display).
TerminalControl
class is not designed for scripting primarily (VirtualTerminal
class is better for this), but it is still possible using the Process
or Expect
methods, but you have to switch TerminalControl
from automatic processing mode to manual by calling the SetProcessingMode
method.
Log in sequence can look like this:
terminal.SetProcessingMode(TerminaProcessingMode.None)
terminal.Bind(New Telnet("host"))
terminal.Expect("gin: ", 9000) ' wait for login
terminal.SendToServer("user" & vbCr)
terminal.Expect("sword: ", 9000) ' wait for password
terminal.SendToServer("password" & vbCr)
terminal.SetProcessingMode(TerminaProcessingMode.Automatic)