;Generate a list of switch ports based on the trunk group number.
;Kevin Smith 4-28-2006
; This version uses Notepad as a buffer.
string fName, sXMit, sCLLI, sQA, sTemp3
string sTextToCopy ; Text to put into NOTEPAD.
string sOFFL[500]
integer iOFFLCnt
proc main
iOFFLCnt = 1
fName = "c:\grouplist.txt"
sQA = "quit all^m"
delfile fName
get_CLLI()
run "notepad.exe" ; Run Windows NOTEPAD.
pause 1 ; Pause to wait for NOTEPAD.
set capture path "c:\"
set capture file "grouplist.txt"
data_collector()
list_builder()
delfile fName
endproc
proc data_collector
;sdlginput "Enter CLLI" "CLLI" sCLLI DEFAULT
sXMit = "mapci nodisp;mtc;trks;stat;selgrp "
strcat sXMit sCLLI
strcat sXMit ";hcpytrk^m"
clear
capture on
transmit sXMIT
waitfor ">" forever
capture off
transmit sQA
endproc
proc list_builder
string sTemp, sType, sMajor, sMinor, sState, sJunk, sTCIC, sOutName, sTemp2
integer iIndex, iIndex2
sOutName = "c:\tempout.txt"
delfile sOutName
fopen 1 sOutName write text
fputs 1 sCLLI
sTemp3 = sCLLI
strtoclip sTemp3 ; Copy string to clipboard.
paste_notepad()
if fopen 0 fName read text
for iIndex = 1 upto 10
fgets 0 sTemp
endfor
while not feof 0
strtok sType sTemp " " 1
strtok sMajor sTemp " " 1
strtok sMinor sTemp " " 1
strtok sJunk sTemp " " 1
strtok sTCIC sTemp " " 1
strtok sState sTemp " " 1
switch sState
case "CPB"
sState = "INSV"
endcase
case "IDL"
sState = "INSV"
endcase
case "INB"
sState = "OFFL"
endcase
case "MB"
sState = "OFFL"
endcase
default
sState = "UNK?"
endcase
endswitch
if strcmp sJunk "1"
strfmt sTemp "%s %6s %6s %6s %6s" sType sMajor sMinor sTCIC sState
fputs 1 sTemp
if strcmp sState "OFFL"
strfmt sTemp2 "%s %s %s" sType sMajor sMinor
sOFFL[iOFFLCnt] = sTemp2
iOFFLCnt++
endif
strcat sTextToCopy sTemp
;strcat sTextToCopy
sTemp3 = sTextToCopy
paste_notepad()
sTextToCopy = ""
endif
fgets 0 sTemp
endwhile
iOFFLCnt = iOFFLCnt -1
iIndex2 = 1
if iOFFLCnt > 1
extra_lf()
sTemp3 = "Command to post OFFL'd T-1's:"
paste_notepad()
endif
sTemp3 = "Post "
if iOFFLCnt > 1
for iIndex = 1 upto iOFFLCnt
if iIndex2 <= 5
strcat sTemp3 sOFFL[iIndex]
strcat sTemp3 " "
iIndex2++
else
iIndex2 = 2
paste_notepad()
sTemp3 = "Post "
strcat sTemp3 sOFFL[iIndex]
strcat sTemp3 " "
endif
endfor
if iIndex2 >1
paste_notepad()
endif
endif
endif
fclose 0
fclose 1
extra_lf()
sTemp3 = "Command to post INB'd trunks:"
paste_notepad()
sTemp3 = "post g "
strcat sTemp3 sCLLI
strcat sTemp3 ";post b b"
paste_notepad()
extra_lf()
sTemp3 = "Note: This program looks at the first trunk of each T-1 to determine if a carrier is INSV or not."
strtoclip sTemp3
paste_notepad()
endproc
proc get_CLLI
string sTKGNum, sXMit, sTemp, sTemp2, fName2
integer iIndex
fName2 = "c:\tkgtemp.txt"
set capture path "c:\"
set capture file "tkgtemp.txt"
sdlginput "Enter TKG#" "Trunk Group Number" sTKGNum DEFAULT
transmit "quit all;table trkname;format pack^m"
waitfor "output is column 1." forever
waitfor ">" forever
sXMit = "pos "
strcat sXMit sTKGNum
strcat sXMit "^m"
clear
capture on
transmit sXMit
waitfor ">" forever
capture off
transmit sQA
waitfor ">" forever
fopen 0 fName2 read text
for iIndex = 1 upto 2
fgets 0 sTemp
endfor
strtok sTemp2 sTemp " " 1
strtok sCLLI sTemp " " 1
fclose 0
delfile fName2
endproc
proc paste_notepad
strtoclip sTemp3 ;Copy text to windows clipboard
sendkey ALT 'E' ;Enter Edit Menu
mspause 250 ;Wait 1/4 second
sendkey 'P' ;Paste
sendkey 0x0d ;linefeed
sTemp3 = "" ;Blank variable
endproc
proc extra_lf
sendkey 0x0d ;linefeed
endproc