Welcome to the VanDyke Software Forums

Join the discussion today!

Go Back   VanDyke Software Forums > Scripting

Closed Thread
Thread Tools Rate Thread Display Modes
Old 12-22-2004, 05:00 PM
wasodg2 wasodg2 is offline
Registered User
Join Date: Dec 2004
Location: Spokane, WAshington
Posts: 16
Unhappy Getting Columes and Rows

The script I've posted below goes thru a text file to get teh IOS versions off of multiple Switches. It all works except getting the Rows and Columns to display(IOS = objsc.Get(Row1, col1, Row2, col2)

I would like to be able to find Just the line that has the IOS on the screen to output to an excel spread sheet but I can get the code to work. Can someone help?

Const ForReading = 1
Const ForWriting = 2
Const ForAppending = 8
Set FSO = CreateObject("scripting.filesystemobject")
Set Shell = CreateObject("WScript.Shell")
Set SwitchIP = FSO.opentextfile("C:\oneIP.txt", ForReading, False)
Set objDictionary = CreateObject("Scripting.Dictionary")
Set objSc = crt.Screen
Set objD = crt.Dialog
Set objSe = crt.Session
Set objW = crt.Window

objsc.Synchronous = True

While Not SwitchIP.atEndOfStream
IP = SwitchIP.Readline()

' connect To host On port 23 (the default telnet port)
'On Error Resume Next
objse.Connect "/TELNET "&IP&" 23"

If ( objse.connected ) Then
objse.logfilename = "c:\crt.Log"
objSc.WaitForString "assword:"
objSc.Send "cisco" & vbCr
wrongstr = objsc.WaitForString(">",1)
'objD.Messagebox "Wrongstr st To " & wrongstr
If wrongstr = -1 Then
objsc.Send "sho ver | include IOS" & vbCr
IOS = objsc.Get(Row1, col1, Row2, col2)
'If InStr(IOS,"Software") Then
objD.Messagebox objsc.Get(Row1, col1, Row2, col2)
objSc.Synchronous = False
objsc.Send "show version" & vbCr
objSc.Synchronous = False
End If


Set Tempfile = FSO.OpenTextFile("C:\output.txt",ForAppending, True)
TempFile.writeline "Could Not Connect to " & IP
End If
Old 12-23-2004, 12:03 PM
adeshotel adeshotel is offline
Registered User
Join Date: Dec 2004
Location: Houston, TX
Posts: 14
Just need to specify what row and columns

Where you have IOS = objsc.Get(Row1, col1, Row2, col2), when you issued the show version command it displays one line up from where your cursor ends up being. Therefore using something like
SelectRow = crt.Screen.CurrentRow - 1
IOSline = crt.Screen.Get(SelectRow, 1, SelectRow, crt.Screen.CurrentColumn )

Will give you the entire line containing the IOS. Now all you need to do is do a VB set of string finds and you can chop out the exteranous stuff to get down to the version.
Old 12-23-2004, 05:06 PM
wasodg2 wasodg2 is offline
Registered User
Join Date: Dec 2004
Location: Spokane, WAshington
Posts: 16
That was it Thanks!!
Closed Thread

Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
Thread Tools
Display Modes Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

All times are GMT -6. The time now is 03:03 PM.