I have made a few changes and made some progress, I think anyway. It will compile ok, but I get an ERROR 5 upon running. All of the files and names appear to be valid. One thing that worked for some odd reason was to change the if nullstr holdthisjohn (line 142) to holdthis12 it would run and create a blank text file, but I didn't get the error 5... pulling out my hair.. any help is appreciated.
string Timestr ; declare string to contain time
string SysInfo ; declare string array
string holdthis ; declare string variable
string capdata ; declare string array
string holdthisjohn ; declare string variable
string srchField[200] ; declare array for field names
integer chrlen[200] ; declare array for field postition
integer num2 ;declare variable
integer Num ;Declare variables
integer Count = 0 ;Declare variables
integer Count2 = 0 ;Declare variables
string szLine ;Declare variables
proc main
Timestr = "23:00:00" ; Assign time for script to run
clear ; Clear the Procomm Screen
set capture overwrite on ; Overwrite Existing capture File
set capture query off ; Do Not Request Query of File Name
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\Traffic_master.txt" READ ; open textfile TEXT,LOGIN,IP
while not feof 0 ; Exit Loop at the end of the file
fgets 0 SysInfo ;Retrieve the next line place in public variable
;Call LOGIN
endwhile
fclose 0 ; Close the Fields textfile
else
errormsg "Couldn't open file Traffic_master.txt."
endif
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\Traffic_files.txt" READ ; open textfile TEXT,LOGIN,IP
while not feof 0 ; Exit Loop at the end of the file
fgets 0 capdata ;Retrieve the next line place in public variable
Call Parse
endwhile
fclose 0 ; Close the Fields textfile
else
errormsg "Couldn't open file Traffic_files.txt."
endif
;Call beforeParse
Call excel
endproc
proc LOGIN
integer Count = 0 ; declare variables
winmaximize $pwmainwin
while 1 ; Loop forever, or until EXITWHILE.
strtok holdthis SysInfo "," 1 ; Retrieve next piece of data from system info text and populate to Serverdata array.
set capture file holdthis ; Set the Capture File Name
if nullstr holdthis ; Check to see if item is null.
exitwhile ; If so, exit loop.
else
Count=0
strtok holdthis SysInfo "," 1 ; Retrieve IP address from system info text.
DIALNUMBER TELNET holdthis ; Contact IP address of server
waitfor "Enter Terminal type : "
transmit "ansi^M" ; keystroke "ansi"
waitfor "Login: "
transmit "root^M" ; keystroke "HD_spec" and enter
waitfor "Password: "
strtok holdthis SysInfo "," 1 ; Retrieve password from system info text.
transmit holdthis
transmit "^M" ; keystroke enter
capture on
waitfor "COMMAND (N/Q/V/P/D/X): " 5 ; This command may never come on some systems causing a 5 second delay
transmit "N^M" ; keystroke "N" and enter (if delayed from previous step, this will cause the (M/R/S/X)

rompt to occur
waitfor "COMMAND (M/R/S/X): " 5 ; This command may never come on some systems causing a 5 second delay
transmit "q^M" ; keystroke "q" and enter
waitfor "Go To QNX? [y/N] "
transmit "y^M" ; keystroke "y" and enter
waitfor "# "
transmit "cd //1/usr/vm/sprint^M"
waitfor "# "
transmit "ls -l^M"
waitfor "# "
transmit "statistics -v^M" ;speech blocks
waitfor "# "
transmit "st_lmenu^M" ; keystroke "ad" and Enter
waitfor ": " ; wait for server response
transmit "d16^M"
waitfor ": "
transmit "e18^M"
waitfor ": "
transmit "f4^M"
waitfor ": "
transmit "g4^M"
waitfor ": "
transmit "hy^M"
waitfor ": "
transmit "r^M"
waitfor "/F): "
transmit "c^M"
waitfor "X): "
transmit "x^M"
waitfor "# "
capture off
transmit "logout^M"
endif
endwhile
endproc
Proc Parse
string holdthisjohn
chdir "C:\Program Files\symantec\Procomm Plus\capture"
Count=0
num=0
num2=0
if fopen 0 "C:\Program Files\symantec\Procomm Plus\Aspect\traffic_fields.txt" READ ; open the Fields textfile
while not feof 0 ; Exit Loop at the end of the file
fgets 0 szline ; Retrieve the next line
strtok srchField[Count] szline "," 1 ; Enter the field header into an array
strtok holdthis szline "," 1 ; Retrieve the position for each field
atoi holdthis chrlen[Count] ; Convert the position to an integer and store in an array
Count += 1 ; Increment the counter
endwhile
fclose 0 ; Close the Fields textfile
endif
while 1 ; Loop forever, or until EXITWHILE.
strtok holdthisjohn capdata "," 1 ; Retrieve next piece of data from system info text and populate to Serverdata array.
fopen 1 holdthisjohn Create TEXT ; Create a new textfile
if nullstr holdthisjohn ; Check to see if item is null.
exitwhile ; If so, exit loop.
else
Count=0
strtok holdthisjohn capdata "," 1 ; Retrieve IP address from system info text.
fopen 0 holdthisjohn read TEXT ;Open the capture file
endif
endwhile
while not feof 0 ; Exit at the end of the file
fgets 0 szline ; Retrieve the next line
for Count2 = 0 upto Count-1 ; Loop to check each field
if strsearch szline srchField[Count2] ; Look for the field header in each line
strtok holdthis szline " " chrlen[Count2] ; Retrieve ASCII string according to field position (i.e. 9 = 9th field on the line)
strlen holdthis num ; Assign num the value of the length of the character string
if count2 == Count-1 ; places every entry on seperate line (csv)
fputs 1 holdthis
else
fwrite 1 holdthis num ; write the string to the output textfile
fwrite 1 "," 1 ; delimit the fields with a comma
endif
endif
endfor
If strsearch szline "Thu " ; Find the start line stats (day of week??)
strtok holdthis szline " " 4
atoi holdthis num2 ; Convert above number to an integer
fputs 1 holdthis
if num2 > 0 ; If the integer isn't null
fgets 0 szline ; then go to the 4th line down which is the
fgets 0 szline
fgets 0 szline
fgets 0 szline ; start of the line stat data.
while not strsearch szline "# exit"
strlen szline num2 ; Determine the character length of the line
if num2 > 45 ; If character length is >45 it is a line stats info line
fputs 1 szline ; Write the data to a new line in the output text file
endif
fgets 0 szline ; get the next line
endwhile
endif
endif
endwhile
;endif
fclose 0
endproc
Proc excel
string prog = "T:\Projects_2004\John\Traffic\LLCJ.xls" ;Excel file w/ Macro to open
run prog
endproc