Im trying to get the script to read from a txt file named friends.txt. The problem is that when it finishes reading the first line of Friend.txt it goes to the next line of friends file without finishing executing the rest of the code. The code stops at waitfor "SARC" and loops back to the next line of the txt.file.I am basically tring to copy the text file into a meridian switch. The text file has like 4000 line items which needs to be imported into the switch. Help!
This is my script below.....................................
............................................................
proc main
string Fname = "c:\friends.txt" ;filename
string authcode[100] ;Get up to 100 entries
string Line ;Place entries in the Line buffer
;string szSpace="'r'n"
integer Counter=0 ;Place pointer to the first line
if fopen 0 Fname READ TEXT ;Open file as read-only
while not feof 0 ;continue loop until the end of file
fgets 0 Line
Authcode[Counter]=Line ;Counter reacts on Line Buffer
Counter++ ;Counter will Loop 1 Line at a time
transmit "^M" ;Sends carriage return
waitfor "REQ " ;Waits for the REQ prompt from the system
transmit "NEW^M" ;Send "NEW"
waitfor "TYPE " ;Waits for the TYPE prompt from the system
transmit "AUT^M" ;Send "AUT"
waitfor "CUST " ;Waits for the CUST prompt from the system
transmit "0^M" ;Send 0
waitfor "SPWD " ;Waits for the SPWD prompt from the system
transmit "RED^M" ;Send FORD [Needs to be change to 0000 ]
waitfor "CODE " ;Waits for the CODE prompt from the system
transmit "^M" ;Sends Carriage Return
termwrites Line RAW ;Prints Line from Bu
waitfor "SARC "
transmit "^M"
waitfor "CLASS "
transmit "1^M"
endwhile ;Begins loop
else
transmit "^M"
endif
endproc
This is my script below.....................................
............................................................
proc main
string Fname = "c:\friends.txt" ;filename
string authcode[100] ;Get up to 100 entries
string Line ;Place entries in the Line buffer
;string szSpace="'r'n"
integer Counter=0 ;Place pointer to the first line
if fopen 0 Fname READ TEXT ;Open file as read-only
while not feof 0 ;continue loop until the end of file
fgets 0 Line
Authcode[Counter]=Line ;Counter reacts on Line Buffer
Counter++ ;Counter will Loop 1 Line at a time
transmit "^M" ;Sends carriage return
waitfor "REQ " ;Waits for the REQ prompt from the system
transmit "NEW^M" ;Send "NEW"
waitfor "TYPE " ;Waits for the TYPE prompt from the system
transmit "AUT^M" ;Send "AUT"
waitfor "CUST " ;Waits for the CUST prompt from the system
transmit "0^M" ;Send 0
waitfor "SPWD " ;Waits for the SPWD prompt from the system
transmit "RED^M" ;Send FORD [Needs to be change to 0000 ]
waitfor "CODE " ;Waits for the CODE prompt from the system
transmit "^M" ;Sends Carriage Return
termwrites Line RAW ;Prints Line from Bu
waitfor "SARC "
transmit "^M"
waitfor "CLASS "
transmit "1^M"
endwhile ;Begins loop
else
transmit "^M"
endif
endproc