View Single Post
  #5  
Old 10-02-2015, 04:13 PM
benitocamela benitocamela is offline
Registered User
 
Join Date: Sep 2015
Posts: 5
The scripts works fine.

You solved my problem !!!!

Thank you Brenda!!!

The final script works like this:

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
Reply With Quote