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

Script failure Can someone help?

Status
Not open for further replies.

icetea

Technical User
Nov 28, 2002
45
US
When I run this script I get this error. Can someone help? I'm in urgent need of help.


Error 5: Invalid identifier

Here is the scipt

string FnameRead = "c:\temp\TEST1.txt" ; File name to be opened.

proc main
string sLine ;Line read from text file
integer iLen ;Integer to hold length of read
string
string sExtOne ;First extension from line read
from text file
string sExtTwo ;Second extension

transmit "pro^M"
waitfor "Action: "
transmit "mod^M"
if fopen 0 "test1.txt" READ ;Open text file
while not feof 0 ;While there is data to be read
from the text file
fgets 0 sLine ;Get line of data
strlen sLine iLen ;Find length of line
if iLen == 0 ;If zero, then we have read a
blank line and are at the end
exitwhile ;Exit while loop
endif
strtok sExtOne sLine "," ;Get data before the comma
strreplace sExtOne "`"" "" ;Delete quotes from the string
sExtTwo = sLine
strreplace sExtTwo "`"" "" ;Delete quotes from remaining data
strreplace sExtTwo "," "" ;Get rid of extra comma
strreplace sExtTwo ";" "" ;Get rid of extra semi-colon too

waitfor "Subscriber Name or Extension: "
transmit sExtOne
transmit "^M"
waitfor "Name (last first) : "
transmit "^M"
waitfor "Class Number : (Previous = 311): "
transmit "^M"
waitfor "Extension [1]"
transmit sExtOne
transmit "^M"
waitfor "Would you like to disable network access for this
subscriber?[Y/N]"
transmit "n^M"
waitfor "Extension [2]"
transmit sExtTwo
transmit "^M"
waitfor "Extension [3] "
transmit ";^M"
endwhile
endif
fclose 0
endproc



Here is the text file

"2871","11871","
"2840","11840","
"2841","11841","
"2842","11842","
"5756","16756","
 
Hello,

Error 5 Indicates that the Path and/or File Names are NOT Found. Make sure that the Absolute Path and File Name(s) are correct.

Hank camphm@bellsouth.net
 
knob,

If I understand you correctly the following change is what I need to do.

string FnameRead = "c:\temp\TEST1.txt" ; File name to be opened.

proc main
string sLine ;Line read from text file
integer iLen ;Integer to hold length of read
string
string sExtOne ;First extension from line read
from text file
string sExtTwo ;Second extension

transmit "pro^M"
waitfor "Action: "
transmit "mod^M"
*****if fopen 0 "c:\temp\test1.txt" READ ;Open text file****
while not feof 0 ;While there is data to be read
from the text file
fgets 0 sLine ;Get line of data

I'm I correct?
 
Hello,

The Syntax is FOPEN 4 "C:\Test.txt" READ TEXT. This opens the File for READ Only and Uses the TEXT Mode.

Hank camphm@bellsouth.net
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top