View Single Post
Old 10-01-2015, 12:49 PM
benitocamela benitocamela is offline
Registered User
Join Date: Sep 2015
Posts: 5
Thanks rtb
Im looking the way to make the loop repeat the command, while the equipment status is not ok.
But when this loop is finished, the script not continuous with the rest:


# $language = "VBScript"
# $interface = "1.0"
' This script demonstrates how to open a text file and it line by
' line to a server.
' Constants used by OpenTextFile()

Const ForReading = 1
Const ForWriting = 2

Sub Main

'Dim logfile
'logfile = "C:\TEMP\mysession.log"
'crt.Session.LogFileName = logfile
Dim fso, file, str
Set fso = CreateObject("Scripting.FileSystemObject")

'crt.Session.Log true
' Note: A runtime exception will be generated if 'input.txt' doesn't exist.
Set file = fso.OpenTextFile("C:\TEMP\mysession.log", ForReading, False)

crt.Screen.Synchronous = True

Do while file.AtEndOfStream <> True

Str = file.Readline
' Send the line with an appended CR

crt.Screen.Send str & VbCr
crt.sleep 1000

crt.Screen.WaitForStrings "assword:",2
' Send your password followed by a carriage return
crt.Screen.Send "PASWORD" & VbCr

crt.Screen.WaitForString "@"
crt.Screen.Send "COMMAND-1" & VbCr
crt.Screen.WaitForString "@"

crt.Screen.Send "CHECK-STATUS-COMMAND" & VbCr

Do While crt.Screen.WaitForString ("busy" & VbCr)
crt.sleep 20000
crt.Screen.Send "CHECK-STATUS-COMMAND" & VbCr

crt.Screen.WaitForString "@"
crt.Screen.Send "exit" & VbCr
crt.Screen.WaitForString "@"

End Sub

which may be the fault?
Reply With Quote