I've used a lot of information from this site to help in my daily activities, so hopefully this post will be useful to somebody here. It is very nice to have when you can't remember what you changed in a crisis, and need to set things back. It is also nice to find certain keywords or numbers in vectors, such as ADJUNCT (so you know which vectors make reference to adjunct links).
This Procomm script saves the text from your vectors into a CSV file. For this to work, you must create a file (VECT1-999.TXT) with each vector number you want to capture on a separate line (I simply have 1 through 999 so nothing gets missed). Create a folder called C:\VECTORS and keep the text file there. That is also where the vector file is saved.
I use a batch file to launch the script as well as to rename the output file (using date/time). I schedule this to run every Sunday evening.
This works in CM2, not sure about CM3.
This Procomm script saves the text from your vectors into a CSV file. For this to work, you must create a file (VECT1-999.TXT) with each vector number you want to capture on a separate line (I simply have 1 through 999 so nothing gets missed). Create a folder called C:\VECTORS and keep the text file there. That is also where the vector file is saved.
I use a batch file to launch the script as well as to rename the output file (using date/time). I schedule this to run every Sunday evening.
This works in CM2, not sure about CM3.
Code:
proc main ;[COLOR=red] This script telnets to the switch,
; scrapes the text for vectors 1-999
; or whichever line numbers are listed
; in C:\VECTORS\VECT1-999.TXT.
; C:\VECTORS\VECT1-999.TXT is used as
; a counter in this example,
; but if you only want to capture
; certain vectors, you can leave
; them out of the TXT file. It is
; required to exist for this to work.[/color red]
string sLine
string vector1
set terminal type att4410
connectmanual TELNET "xxx.xxx.xxx.xxx port 5111"
;[COLOR=red] replace xxx's with IP address used for ASA [/color red]
while $DIALING
yield
endwhile
waitfor "Login: "
transmit "xxx" ;[COLOR=red] replace xxx with login[/color red]
transmit "^M"
waitfor "Password: "
transmit "xxx" ;[COLOR=red] replace xxx with password[/color red]
transmit "^M"
waitfor "Terminal Type (513, 715, 4410, 4425, VT220, NTT, W2KTT, SUNT): [513] "
transmit "4410^M"
waitfor "^[[KCommand: "
fopen 0 "C:\Vectors\VECT1-999.txt" READ TEXT
while not feof 0
fgets 0 sLine
strtok vector1 sLine "," 1
transmit "disp vect "
pause 1
transmit vector1
pause 1
transmit "^M"
call vector1
;[COLOR=red] This is where it begins
; scraping the lines from each page...[/color red]
endwhile
fclose 0
endproc
proc vector1
call page1
transmit "^[OV" ;[COLOR=red]next page[/color red]
call page2
transmit "^[OV" ;[COLOR=red]next page[/color red]
call page3
endproc
proc page1
string Line ; [COLOR=red]Line to write to file.[/color red]
integer Row ; [COLOR=red]Current row to get.[/color red]
pause 3
if fopen 1 "C:\VECTORS\file.csv" APPEND
;[COLOR=red] Create file to write screen to.[/color red]
for Row = 3 upto 3
;[COLOR=red] Loop through each row on screen.[/color red]
termgets Row 4 Line 75
;[COLOR=red] Get line specified by row.[/color red]
fputs 1 Line
;[COLOR=red] Write line from screen to file.[/color red]
fputs 1 "`r`r"
endfor
fclose 1
;[COLOR=red] Close file opened for create.[/color red]
else
errormsg "Couldn't open file!"
endif
if fopen 1 "C:\VECTORS\file.csv" APPEND
for Row = 8 upto 18
termgets Row 0 Line 79
fputs 1 Line
fputs 1 "`r"
endfor
fclose 1
else
errormsg "Couldn't open file!"
endif
endproc
proc page2
string Line
integer Row
pause 3
if fopen 1 "C:\VECTORS\file.csv" APPEND
for Row = 4 upto 14
termgets Row 0 Line 79
fputs 1 Line
fputs 1 "`r"
endfor
fclose 1
else
errormsg "Couldn't open file!"
endif
endproc
proc page3
string Line
integer Row
pause 3
if fopen 1 "C:\VECTORS\file.csv" APPEND
for Row = 4 upto 14
termgets Row 0 Line 79
fputs 1 Line
fputs 1 "`r"
endfor
fclose 1
else
errormsg "Couldn't open file!"
endif
pause 1
transmit "^[OP"
endproc