# Help!! Procomm Plus Script for reading & cap text



## testeng (Feb 16, 2007)

I have a PC that has an existing Procom Plus 4.8 program that uses Aspect Scripts.
What I need to do is create a simple test for the Procomm Plus program of this PC.

I am having trouble reading an entire text file and checking for a specific word, before sending a user message


These are the steps I need to work.

A.) I need to read the entire text file (I am only reading the first string to the CR/LF.)

B.) I need to check for the word "DENY"

C.) If I see the word "DENY", then print Match Found!.

The A.) step is not working. I am only reading the first string to the CR/LF.



The code:

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;CAPTURE TEXT 1

proc setupProc
delfile "c:\Temp\temp.txt"
set txpace 10
set capture path "c:\Temp"
set capture file "temp.txt"
waitfor "RTRV-EQPT::ALL:;" 5
capture on
transmit "^M"
waitfor ";" 5
capture off
endproc

;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;READ TEXT 1

proc checkcomplete
string sLine

fopen 0 "c:\Temp\temp.txt" read text ;Read the temp textfile
while not feof 0
fgets 0 sLine ;Read the first string of the text
if strfind sLine "DENY" ;See if the text has the word "DENY"
usermsg "Match found!" ;If the word "DENY" exists print Match Found
else
usermsg "No matches!" ;Else print No matches!
return
endif
endwhile
fclose 0
endproc


----------



## testeng (Feb 16, 2007)

I got the fix with the following setup:

string sLine
integer Loops=0

fopen 0 "c:\Temp\temp.txt" read text
while (Loops) < 100
fgets 0 sLine
if strfind sLine "DENY"
usermsg "UNIT FAILED!"
endif
Loops++
endwhile
fclose 0
endproc


----------

