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
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