Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Script has a runtime problem - Nortel script 4

Status
Not open for further replies.

atascoman

Technical User
Oct 10, 2003
868
0
0
US
This is a script I use to add new phones and it seems to be adding extra carriage returns in the process somehow. I tried bulding it to do a whole phone, but it fails after Key 1 by entering a least one extra carriage return causing the PBX to think the programming for that TN is done.

As it is now when it reaches the end of the script and finishes Key 1 thePBX goes back to the REQ prompt and instead of the script starting over like it's supposed to it enters(or has carried over 2 carriage returns from the last run). It still works, but I would like to try and find out what the problem is with my code that is causing this. The script also doesn't automatically stop running when it hits the end of the data file. I have to manually turn it off.

;Recorded script. Editing may be required.
proc main

string sline, tn, key0

fopen 0 "aisdipsets.txt" READ ;Open our data file
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok tn sLine "`t" 1;
strtok key0 sLine "`t" 1;

set txpace 50

waitfor "REQ: "
transmit "NEW^M"
waitfor "TYPE: "
transmit "1120^M"
waitfor "TN "
transmit tn
transmit "^M"
waitfor "DES "
transmit "ADMIN^M"
waitfor "CUST "
transmit "0^M"
waitfor "NUID "
transmit "^M"
waitfor "NHTN "
transmit "^M"
waitfor "KEM "
transmit "^M"
waitfor "ZONE "
transmit "2^M"
waitfor "ERL "
transmit "^M"
waitfor "ECL "
transmit "^M"
waitfor "FDN "
transmit "4399^M"
waitfor "TGAR "
transmit "^M"
waitfor "LDN "
transmit "^M"
waitfor "NCOS "
transmit "2^M"
waitfor "RNPG "
transmit "^M"
waitfor "SSU "
transmit "^M"
waitfor "SGRP "
transmit "^M"
waitfor "CLS "
transmit "MWA IRA OLA LNA CNDA DNDA HFA HTA FNA^M"
waitfor "RCO "
transmit "^M"
waitfor "HUNT "
transmit "4399^M"
waitfor "LHK "
transmit "1^M"
waitfor "LNRS "
transmit "^M"
waitfor "SCI "
transmit "^M"
waitfor "LPK "
transmit "1^M"
waitfor "PLEV "
transmit "^M"
waitfor "DANI "
transmit "^M"
waitfor "AST "
transmit "^M"
waitfor "IAPG "
transmit "^M"
waitfor "MLWU_LANG "
transmit "^M"
waitfor "MLNG "
transmit "^M"
waitfor "DNDR "
transmit "^M"
waitfor "KEY "
transmit "0 SCR "
transmit key0
transmit "^M"
waitfor " CPND "
transmit "^M"
waitfor " VMB "
transmit "^M"
waitfor "KEY "
transmit "^M"
endwhile
fclose 0

endproc
 
Since you are not using the TEXT flag with the fopen command, what is likely happening is that the carriage return at the end of that line is being sent along with the variable. You can either add TEXT to the end of your fopen statement or remove the transmit "^M" that follows.

Regarding the script not stopping at the end of the file, you might check to make sure you don't have a blank line or a line with whitespace at the end of the file.

 
Just to make sure I am on the right track my fopen line needs to be:

fopen 0 "file.txt" READ TEXT
 
Just out of curriosity....
Why don't you use the CPY function to make the new sets,
since you make all sets the same, you can use one as a template
and copy it into another TN.
Something like...(typed, not tested)
Code:
waitfor "REQ: "
   transmit "CPY 1^M"
   waitfor "TYPE: "
   transmit "1120^M"
   waitfor "FROM TN"
   transmit "6 1^M"  ; Template TN
   waitfor "TO TN"
   transmit tn
   transmit "^M"
   waitfor "DN  "
   transmit key0
   transmit "^M"

This way you dont need to step trough every prompt the
switch trows at you like it does when you NEW a set.
Less likely to bomb out because of a missing CR or other error.

HTH

 
I'll have to try that out and see how it works. I have had problems with the CPY command causing DB corruption in the past so I am a little gunshy of it. May not be an issue anymore on the newer releases.
 
Thanks all. Adding the TEXT worked. Just wanted to let everyone know.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top