Ok.
(Sorry, you'll need to copy the file on your Editor to see it properly)
Some messages at Spanish (Pass/Fail conditions, Etc)
Basically, I performed 2 test Circuit & Pack Diagnostic, I save both results into a file text, then I open that file, and save each line into an array, and (see the evalrslt proc) then evaluate the result for each slot (in this case 4 Units at Slots AP-5, AP-7, AP-10 and AP-15)
blah blah
some variables
(then the folder in that I save response)
string RSLTS2= "D:\LPA-PROG\TestRslt\PkRslts.txt"
string RSLTS1= "D:\LPA-PROG\TestRslt\CktRslts.txt"
And the proc for get data...
string szData1,RESP1,RESP2,RESP3,RESP4
proc GetData1
set aspect rgetchar 10 ; set break character to <CR>
sendkey ALT 'U'
waitfor "Received" 25
if SUCCESS
rget szData1 RAW ;steal characters from com port
strfmt RESP1 "%s" szData1
rget szData1
strfmt RESP2 "%s" szData1
rget szData1
strfmt RESP3 "%s" szData1
rget szData1
strfmt RESP4 "%s" szData1
endif
if FAILURE
strfmt RESP1 "rget failed to get characters from COM port"
strfmt RESP2 "rget failed to get characters from COM port"
strfmt RESP3 "rget failed to get characters from COM port"
strfmt RESP4 "rget failed to get characters from COM port"
endif
if fopen 0 RSLTS1 APPEND ; Create and open file.
fstrfmt 0 "%s" RESP1
fstrfmt 0 "%s" RESP2
fstrfmt 0 "%s" RESP3
fstrfmt 0 "%s" RESP4
fclose 0 ; Close the file.
else
errormsg "Can't open `"%s`" for output." RSLTS1
endif
endproc
And the proc to evaluate that data
proc EvalRslt1
string LineInfo1[20]; Array for lines
string Mac1=""
string Line1="BB_DGN_CKT message Ap"
string Line2="num_rec 0x00"
integer Number1
integer i
i=0
if isfile RSLTS1 ; Make sure file exists.
if fopen 0 RSLTS1 READ ; Open file for read.
while not feof 0 ; Loop to end of file.
fgets 0 LineInfo1 ; Get line from file & store it on array.
i=i+1
endwhile
fclose 0 ; Close the file.
endif
else
errormsg "File doesn't exist."
endif
for i=0 upto 15 ; Count for Filename
if strfind LineInfo1 Line1 ; Check for target text in string.
substr Mac1 LineInfo1 25 2 ; Get Slot number for results
atoi Mac1 Number1
switch Number1 ; Find value of numeric variable
case 5
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT5A = 0
else
STAT5A = 1
endif
endcase
case 7
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT7A = 0
else
STAT7A = 1
endif
endcase
case 10
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT10A = 0
else
STAT10A = 1
endif
endcase
case 15
if strfind LineInfo1[i+1] Line2 ; Check for target text in string.
STAT15A = 0
else
STAT15A = 1
endif
endcase
endswitch
endif
endfor
if IntVar1==1
if STAT5A==1
;usermsg "Unidad en Slot AP5 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo1
strfmt F "Unidad en Slot AP5 con numero de serie %s FALLO Circuit Diags" SerNo1
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo1
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif
if IntVar2==1
if STAT7A==1
;usermsg "Unidad en Slot AP7 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo2
strfmt F "Unidad en Slot AP7 con numero de serie %s FALLO Circuit Diags" SerNo2
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo2
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif
if IntVar3==1
if STAT10A==1
;usermsg "Unidad en Slot AP10 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo3
strfmt F "Unidad en Slot AP10 con numero de serie %s FALLO Circuit Diags" SerNo3
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo3
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif
if IntVar4==1
if STAT15A==1
;usermsg "Unidad en Slot AP15 con numero de serie %s FALLO Circuit Diags`r`n\
;Retire la Unidad e idenfiquela como Falla de Circuit Diagnostic" SerNo4
strfmt F "Unidad en Slot AP15 con numero de serie %s FALLO Circuit Diags" SerNo4
MakeDlgBox4Fail()
S0="FAIL"
strfmt S2 SerNo4
I1=1
I2=01
S3="Circuit Diagnostic"
endif
Datalog()
endif
endproc ;--------------------------------------------------------------------------------
Edu Melendez