View Single Post
  #1  
Old 09-26-2005, 03:37 PM
miwiley miwiley is offline
Registered User
 
Join Date: Sep 2005
Posts: 1
Cisco telnet to devices in .txt file

Here the script that is interactive today, but I want to have a flat .txt file with devices and specifc commands as well. How can I modify to reflect?

Thanks in advance!
/mike


*******************************

Sub main
' turn on synchronous mode so we don't miss any data
crt.Screen.Synchronous = True

Dim LoggSession

LoggSession = crt.dialog.MessageBox("Do you want to log this session y/n?", "Who is your daddy?", ICON_QUESTION Or BUTTON_YESNO Or DEFBUTTON2 )


' Supply only the prompt text, accept defaults for everything else.

Dim logfile

logfile = crt.Dialog.Prompt("What is the logfile name?")

logfile = (logfile & ".log")

crt.Session.LogFileName = logfile

' Enable logging
'
crt.Session.Log True

Dim result

' Supply only the prompt text, accept defaults for everything else.
'
result = crt.Dialog.Prompt("What Device do you want to Telnet To?")

' Prompt by supplying all of the parameters

crt.Screen.send("telnet " & result & VbCr)
crt.Screen.WaitforString "name: "
crt.Screen.send "username" & VbCr
crt.Screen.WaitForString "assword:"
crt.Screen.send "password" & VbCr
crt.Screen.WaitForString ">"
crt.Screen.send "enable" & VbCr
crt.Screen.WaitForString "assword:"
crt.Screen.send "password" & VbCr
crt.Screen.WaitForString "#"

Dim commands

Do

' Supply only the prompt text, accept defaults for everything else.
'
commands = crt.Dialog.Prompt("What Commands do you want to run?")

' Prompt by supplying all of the parameters

crt.Screen.send(commands & VbCr)
crt.Screen.WaitforString "#"

commands = crt.dialog.MessageBox("Do you want to run more commands y/n?", "Hello!", ICON_QUESTION Or BUTTON_YESNO Or DEFBUTTON2 )

If commands = IDNO Then

' Stop logging and disconnect.
crt.Session.Log False
crt.Screen.send "exit" & VbCr

Exit Sub

End If

loop

End Sub
Reply With Quote