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 demonstrates one way to send a text file to a unix server
' This is equivalent to doing an "send ASCII" in a script.

' Constants used by OpenTextFile()
Const ForReading = 1
Const ForWriting = 2

Sub Main

  ' Create an instance of the filesystem object so we can open a file
  ' Note: A runtime exception will be generated if 'myfile.txt' doesn't exist.
  '
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set file = fso.OpenTextFile("c:\temp\myfile.txt", ForReading, False)

  ' Send a 'cat' command to direct everything we are about to send into a file.
  '
  crt.Screen.Send"cat > output.txt" & vbCR

  ' The next line causes the script to wait until the 'cat' command has been 
  ' sent (and executed) by the server. So that the data we're about to send
  ' doesn't get sent until redirected 'cat' command is actually in effect.
  '
  crt.Screen.WaitForString"output.txt"

  ' Send the file a line at a time.
  '
  DoWhile file.AtEndOfStream <> True
    str = file.Readline
    crt.Screen.Send str & Chr(13)
  Loop

  ' send an EOF character to end output to terminate 'cat'
  '
  crt.Screen.SendChr(4)

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