Gents,
This one seems to be giving me some trouble and I was wondering if anyone could give me a hand. I wrote a different script than the one below that goes into a system and gathers all kinds of specific data on a lot of different items. After I have gathered that data, I want to go back, parse the items from the file and then put them back in the system exactly how they came out. Sounds wierd, but it's just one of those things. However, I am running into a couple of different problems.
1. When I first started the script, I had the strtok for the POTS portion on top of the if and everything except for sNode worked great. When I moved it and included a different type, TO, it doesn't to any parsing. I thought it would work this way, but I guess I'm wrong.
2. My second problem is parsing sNode. I can't seem to get it. Essentially, you get one instance of sNode in the original capture file and then you get all of the settings for that type of circuit for that particular node and then you move onto the next node and so on and so forth. More or less, I need the node to be unique and must capture that string.
proc ProvFacsCircs
string sTemp = ""
string sLine = ""
string sNode = ""
string sType = ""
string sShelf = ""
string sSlot = ""
string sCircuit = ""
string sBtc = ""
string sFrd = ""
string sCmp = ""
string sGn = ""
string sImp = ""
string sCircuitTo = ""
string sSealC = ""
string sRxImp = ""
string sTxImp = ""
string sRxGain = ""
string sTxGain = ""
string sMode = ""
fopen 0 "C:\Program Files\Symantec\Procomm Plus\Capture\test.cap" READ TEXT
transmit "34^M"
while not feof 0
fgets 0 sLine
if strfind sType "POTS"
; These are the tokens for the exact locations and settings of the POTS circuits.
strtok sNode sTemp "RDTx]: " 1
strtok sType sLine " -" 1
strtok sShelf sLine "- " 1
strtok sSlot sLine "-GP " 1
strtok sCircuit sLine "-CKT " 1
strtok sBtc sLine " " 1
strtok sFrd sLine " " 1
strtok sCmp sLine " " 1
strtok sGn sLine " " 1
strtok sImp sLine " " 1
;Provision the POTS Port settings now.
transmit "2^M"
transmit "1^M"
transmit "PHYS^M"
waitfor " Node [^[[7mCDT^[[m, RDTx]: "
transmit sNode
transmit "^M"
waitfor " Shelf# [^[[7m1^[[m-15]: "
transmit sShelf
transmit "^M"
waitfor " GP Slot [^[[7m1^[[m-20]: "
transmit sSlot
transmit "^M"
waitfor " POTS Port [^[[7m1^[[m-8 ]: "
transmit sCircuit
transmit "^M"
waitfor " System Gain [ ^[[7m-2^[[m, 0 ]: "
transmit sGn
transmit "^M"
waitfor " Impedance [600, ^[[7m900^[[m]: "
transmit sImp
transmit "^M"
; Provision the POTS Port DS0 settings now.
transmit "4^M"
transmit "1^M"
transmit "PHYS^M"
waitfor " Node [^[[7mCDT^[[m, RDTx]: "
transmit sNode
transmit "^M"
waitfor " Shelf# [^[[7m1^[[m-15]: "
transmit sShelf
transmit "^M"
waitfor " GP Slot [^[[7m1^[[m-20]: "
transmit sSlot
transmit "^M"
waitfor " POTS Port [^[[7m1^[[m-8 ]: "
transmit sCircuit
transmit "^M"
waitfor " Blocked Terminating Call [C, ^[[7mD^[[m]: "
transmit sBtc
transmit "^M"
elseif strfind sType "TO"
; These are the tokens for the exact locations and settings of the TO circuits.
strtok sNode sTemp "RDTx]: " 1
strtok sType sLine " -" 1
strtok sShelf sLine "- " 1
strtok sSlot sLine "-GP " 1
strtok sCircuitTo sLine "-CKT " 1
strtok sSealC sLine " " 1
strtok sRxImp sLine " " 1
strtok sTxImp sLine " " 1
strtok sRxGain sLine " " 1
strtok sTxGain sLine " " 1
strtok sMode sLine " " 1
;Provision the TO Port settings now.
transmit "2^M"
transmit "3^M"
transmit "PHYS^M"
waitfor " Node [^[[7mCDT^[[m, RDTx]: "
transmit sNode
transmit "^M"
waitfor " Shelf# [^[[7m1^[[m-15]: "
transmit sShelf
transmit "^M"
waitfor " GP Slot [^[[7m1^[[m-20]: "
transmit sSlot
transmit "^M"
waitfor " TO Port [^[[7m1^[[m-4 ]: "
transmit sCircuitTo
transmit "^M"
waitfor " 3 - SINK ]: "
transmit sSealC
transmit "^M"
waitfor " TO Mode [ 2wire,^[[7m4wire^[[m]: "
transmit sMode
transmit "^M"
waitfor " Rx Impedance [^[[7m600^[[m, 1200]: "
transmit sRxImp
transmit "^M"
waitfor " Tx Impedance [^[[7m600^[[m, 1200]: "
transmit sTxImp
transmit "^M"
waitfor " Rx Gain [ +8.5 to -16.0, ^[[7m +0.0^[[m]: "
transmit sRxGain
transmit "^M"
waitfor " Tx Gain [ +7.0 to -17.5, ^[[7m +0.0^[[m]: "
transmit sTxGain
transmit "^M"
endif
endwhile
waitfor ">" forever
transmit "^["
waitfor ">" forever
transmit "^["
waitfor ">" forever
transmit "6^M"
waitfor "Logon:"
transmit "`r`nThe script is complete. Please verify all settings.`r`n"
fclose 0
endproc
This one seems to be giving me some trouble and I was wondering if anyone could give me a hand. I wrote a different script than the one below that goes into a system and gathers all kinds of specific data on a lot of different items. After I have gathered that data, I want to go back, parse the items from the file and then put them back in the system exactly how they came out. Sounds wierd, but it's just one of those things. However, I am running into a couple of different problems.
1. When I first started the script, I had the strtok for the POTS portion on top of the if and everything except for sNode worked great. When I moved it and included a different type, TO, it doesn't to any parsing. I thought it would work this way, but I guess I'm wrong.
2. My second problem is parsing sNode. I can't seem to get it. Essentially, you get one instance of sNode in the original capture file and then you get all of the settings for that type of circuit for that particular node and then you move onto the next node and so on and so forth. More or less, I need the node to be unique and must capture that string.
proc ProvFacsCircs
string sTemp = ""
string sLine = ""
string sNode = ""
string sType = ""
string sShelf = ""
string sSlot = ""
string sCircuit = ""
string sBtc = ""
string sFrd = ""
string sCmp = ""
string sGn = ""
string sImp = ""
string sCircuitTo = ""
string sSealC = ""
string sRxImp = ""
string sTxImp = ""
string sRxGain = ""
string sTxGain = ""
string sMode = ""
fopen 0 "C:\Program Files\Symantec\Procomm Plus\Capture\test.cap" READ TEXT
transmit "34^M"
while not feof 0
fgets 0 sLine
if strfind sType "POTS"
; These are the tokens for the exact locations and settings of the POTS circuits.
strtok sNode sTemp "RDTx]: " 1
strtok sType sLine " -" 1
strtok sShelf sLine "- " 1
strtok sSlot sLine "-GP " 1
strtok sCircuit sLine "-CKT " 1
strtok sBtc sLine " " 1
strtok sFrd sLine " " 1
strtok sCmp sLine " " 1
strtok sGn sLine " " 1
strtok sImp sLine " " 1
;Provision the POTS Port settings now.
transmit "2^M"
transmit "1^M"
transmit "PHYS^M"
waitfor " Node [^[[7mCDT^[[m, RDTx]: "
transmit sNode
transmit "^M"
waitfor " Shelf# [^[[7m1^[[m-15]: "
transmit sShelf
transmit "^M"
waitfor " GP Slot [^[[7m1^[[m-20]: "
transmit sSlot
transmit "^M"
waitfor " POTS Port [^[[7m1^[[m-8 ]: "
transmit sCircuit
transmit "^M"
waitfor " System Gain [ ^[[7m-2^[[m, 0 ]: "
transmit sGn
transmit "^M"
waitfor " Impedance [600, ^[[7m900^[[m]: "
transmit sImp
transmit "^M"
; Provision the POTS Port DS0 settings now.
transmit "4^M"
transmit "1^M"
transmit "PHYS^M"
waitfor " Node [^[[7mCDT^[[m, RDTx]: "
transmit sNode
transmit "^M"
waitfor " Shelf# [^[[7m1^[[m-15]: "
transmit sShelf
transmit "^M"
waitfor " GP Slot [^[[7m1^[[m-20]: "
transmit sSlot
transmit "^M"
waitfor " POTS Port [^[[7m1^[[m-8 ]: "
transmit sCircuit
transmit "^M"
waitfor " Blocked Terminating Call [C, ^[[7mD^[[m]: "
transmit sBtc
transmit "^M"
elseif strfind sType "TO"
; These are the tokens for the exact locations and settings of the TO circuits.
strtok sNode sTemp "RDTx]: " 1
strtok sType sLine " -" 1
strtok sShelf sLine "- " 1
strtok sSlot sLine "-GP " 1
strtok sCircuitTo sLine "-CKT " 1
strtok sSealC sLine " " 1
strtok sRxImp sLine " " 1
strtok sTxImp sLine " " 1
strtok sRxGain sLine " " 1
strtok sTxGain sLine " " 1
strtok sMode sLine " " 1
;Provision the TO Port settings now.
transmit "2^M"
transmit "3^M"
transmit "PHYS^M"
waitfor " Node [^[[7mCDT^[[m, RDTx]: "
transmit sNode
transmit "^M"
waitfor " Shelf# [^[[7m1^[[m-15]: "
transmit sShelf
transmit "^M"
waitfor " GP Slot [^[[7m1^[[m-20]: "
transmit sSlot
transmit "^M"
waitfor " TO Port [^[[7m1^[[m-4 ]: "
transmit sCircuitTo
transmit "^M"
waitfor " 3 - SINK ]: "
transmit sSealC
transmit "^M"
waitfor " TO Mode [ 2wire,^[[7m4wire^[[m]: "
transmit sMode
transmit "^M"
waitfor " Rx Impedance [^[[7m600^[[m, 1200]: "
transmit sRxImp
transmit "^M"
waitfor " Tx Impedance [^[[7m600^[[m, 1200]: "
transmit sTxImp
transmit "^M"
waitfor " Rx Gain [ +8.5 to -16.0, ^[[7m +0.0^[[m]: "
transmit sRxGain
transmit "^M"
waitfor " Tx Gain [ +7.0 to -17.5, ^[[7m +0.0^[[m]: "
transmit sTxGain
transmit "^M"
endif
endwhile
waitfor ">" forever
transmit "^["
waitfor ">" forever
transmit "^["
waitfor ">" forever
transmit "6^M"
waitfor "Logon:"
transmit "`r`nThe script is complete. Please verify all settings.`r`n"
fclose 0
endproc