Sample scripts

SecureCrt

Download securecrt.tlb type library


# $language = "VBScript"
# $interface = "1.0"

'library:c:\mytypelib\securecrt.tlb
'Dim crt As SecureCrt.crt

' This script sets a specific logfile, enables logging then connects
' to a server. After capturing the output of a command to the logfile
' logging is disabled and it disconnects.

Sub Main

  ' Turn on synchronous mode while performing Send/Wait sequences
  ' so no input is missed.
  '
  crt.Screen.Synchronous = True

  ' Connect using a pre-defined session that automatically logs me in. 
  '
  crt.Session.Connect"/s mysession"

  ' Wait for my unix login prompt or for 5 seconds whichever
  ' comes first.
  '
  crt.Screen.WaitForString"linux$", 5

  ' Set the name of the log file name "YYMMDD.log"
  '
  Dim logfile
  logfile = "C:\TEMP\mysession.log"
  crt.Session.LogFileName = logfile

  ' Enable logging
  '
  crt.Session.LogTrue

  ' Send a unix command. The output of the command will
  ' be captured to the logfile.
  '
  crt.Screen.Send"date" & vbCr

  ' Wait again for my login prompt or 5 seconds
  '
  crt.Screen.WaitForString"linux$", 5

  ' Turn off synchronous mode
  crt.Screen.Synchronous = false

  ' Stop logging and disconnect.
  '
  crt.Session.LogFalse
  crt.Session.Disconnect

EndSub



VbsEdit provides Intellisense for SecureCRT!


This package includes VbsEdit 32-bit, VbsEdit 64-bit, HtaEdit 32-bit and HtaEdit 64-bit.
The evaluation version never expires.




Home  

Copyright © 2001-2017 Adersoft