View Single Post
  #3  
Old 10-14-2015, 12:33 PM
benitocamela benitocamela is offline
Registered User
 
Join Date: Sep 2015
Posts: 5
Hi Jack

Im set the Screen object's "Synchronous" property to true, you can see it in the script:

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

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:\MY_ROUTERS.txt", ForReading, False)
crt.Screen.Synchronous = True
crt.Screen.Clear

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.WaitForString "assword:",2
' Send your password followed by a carriage return
crt.Screen.Send "My_PASSWORD" & VbCr

crt.Screen.WaitForString ">"
crt.Screen.Send "COMMAND_1" & VbCr
crt.Screen.WaitForString ">"

crt.Screen.Send "CHECK_STATUS" & VbCr

nTimeout = 5
Do While crt.Screen.WaitForString ("busy", nTimeout)
crt.sleep 60000
crt.Screen.Send "CHECK_STATUS" & VbCr
Loop
crt.Screen.Send VbCr
crt.Screen.WaitForStrings ">"
crt.Screen.Send "exit" & VbCr

crt.Screen.WaitForString "~]$"

Loop

End sub
When i send crt.Screen.Send "CHECK_STATUS" & VbCr, im wait the word busy to start the loop until the router status is different than busy.

Text format where the word is busy after send the check status command, is:

Quote:
TASK JOBS QUEUED: [OK]
OPERATIONS QUEUED: [OK]
CPU: 0.05% < 50% [OK]

Router resources are busy

Regards
Reply With Quote