INTELLIGENT WORK FORUMS
FOR COMPUTER PROFESSIONALS

Log In

Come Join Us!

Are you a
Computer / IT professional?
Join Tek-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!

*Tek-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Jobs

Add a bunch of new CPNDs using a script

Add a bunch of new CPNDs using a script

(OP)
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:

[indent][/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.

RE: Add a bunch of new CPNDs using a script

(OP)
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

RE: Add a bunch of new CPNDs using a script

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.

RE: Add a bunch of new CPNDs using a script

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 = http://somertel.com

RE: Add a bunch of new CPNDs using a script

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 ").

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Tek-Tips Forums free from inappropriate posts.
The Tek-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Tek-Tips forums is a member-only feature.

Click Here to join Tek-Tips and talk with other members!

Resources

Close Box

Join Tek-Tips® Today!

Join your peers on the Internet's largest technical computer professional community.
It's easy to join and it's free.

Here's Why Members Love Tek-Tips Forums:

Register now while it's still free!

Already a member? Close this window and log in.

Join Us             Close