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 shows how to read in a file, and it demonstrates how to
' perform some preprocessing on data (splitting the file data into 
' separate strings) before sending it to a server.

' Constant used by OpenTextFile()
Const ForReading = 1

Sub main

  ' Open a file, read it in & send it one line at a time
  Dim fso, f

  Set fso = CreateObject("Scripting.FileSystemObject")

  Set f = fso.OpenTextFile("c:\temp\printers.txt", ForReading, 0)

  Dim line, params
  DoWhile f.AtEndOfStream <> True

    ' Read each line of the printers file.
    '
    line = f.Readline

    ' Split the line up. Each line should contain 3 space-separated parameters
    params = Split( line )

    ' params(0) holds parameter 1, params(1) holds parameter 2, etc.
    '
    ' Send "mycommand" with the appended parameters from the file with
    ' an appended CR.
    '
    crt.Screen.Send"mycommand" & params(0) & " " & params(1) & " " & params(2) & " " & vbCR

    ' Cause a 3-second pause between sends by waiting for something "unexpected"
    ' with a timeout value.
    crt.Screen.WaitForString"something_unexpected", 3
  Loop

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