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 SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Add a bunch of new CPNDs using a script

Status
Not open for further replies.

SherWat

Technical User
Feb 12, 2016
216
0
16
CA
Hello all. I would like to create a script that would access a .csv file to add in a bunch of new CPND names in a CS1000E system

I have created this script below so far:
proc main

string sline, DN,NAME

fopen 0 "ACDCPND.CSV" READ ;Open our data file
while not feof 0 ;While the file still has data
fgets 0 sLine ;Read a line of data
strtok DN sLine "`t" 1 ;Get the first field
strtok NAME sLine "`t" 1 ;Get the second field


set txpace 30
waitfor "req:"
transmit "new^M"
waitfor "type"
transmit "NAME^M"
waitfor "CUST "
transmit "0^M"
waitfor "DIG "
transmit "^M"
waitfor "DN "
transmit "^M"
waitfor " NAME "
transmit "^M"
waitfor " XPLN "
transmit "^M"
waitfor " DISPLAY_FMT "
transmit "^M"

endwhile

fclose 0


endproc

when it is run on the PBX in Procomm, it does this:

[/DISK SPACE NEEDED: 329 KBYTES
REQ new
TYPE NAME
CUST 0
DIG
DN
ENTR
DCNO

MEM AVAI
indent]

So obviously it isn't even accessing the file.

I do not know much about scripting, so any assistance would be greatly appreciated.

thanks.​
 
I was able to get it working, however, I could only get it to work by sending enter after each prompt.
It also runs slow - it seems to wait a long time before doing the next entry. Is there a way to short this?
Also, what would I need to change in order for it to read the next line in the file after each enter after DISPLAY_FMT so it won't go back to the REQ prompt?

Below is the file that is working, albeit very slowly.


proc main

string sline, DN,NAME

fopen 0 "ACDCPND.txt" READ ;Open our data file
while not feof 0 ;Loop while not end of file
fgets 0 sLine ;Read a line of data
strtok DN sLine "`t" 1 ;Get the first field
strtok NAME sLine "`t" 1 ;Get the second field


waitfor "req:"
transmit "new^M"
waitfor "type"
transmit "NAME^M"
waitfor "CUST "
transmit "0^M"
waitfor "DIG "
transmit "^M"
waitfor "DN "
transmit DN
transmit "^M"
waitfor "NAME "
transmit NAME
transmit "^M"
waitfor "XPLN "
transmit "^M"
waitfor "DISPLAY_FMT "
transmit "^M"
waitfor "ENTR"
transmit "^M"
waitfor "DCNO"
transmit "^M"


endwhile

fclose 0


endproc
 
Your waitfor commands are not seeing what you are waiting for. For example, "waitfor "type" is not seeing the word "type." Therefore, it times out after 30 seconds, the default then goes to the next line.
 
On the Nortel CS1000 forum FAQ section is an area where I've uploaded a bunch of scripts for Procomm some time ago.

Firebird Scrambler

Nortel & Avaya Meridian 1 / Succession & BCM / Norstar Programmer

Website =
 
kxboy - Your waitfor commands are not seeing what you are waiting for. For example, "waitfor "type" is not seeing the word "type." Therefore, it times out after 30 seconds, the default then goes to the next line.

This is correct. As a matter of fact SherWat your script will never see type since the CS1K responds in capital letters. Try changing that bit to waitfor "TYPE " (note the space after the word TYPE and before the closing ").
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top