In this image...
https://imgur.com/2gIj3ik
But OCR is only reading the value of 10 as in this output:
This is the codeThe value 30 was not found in the table. ...
| 806,248,863,273 > 10 | 806,281,863,306 > | 806,314,863,339 >
| 806,347,863,372 > 10
| 806,380,863,405 > 10
| 806,413,863,438 > | 806,446,863,471 > | 806,479,863,504 > | 806,512,863,537 >
| 806,545,863,570 > 10
| 806,578,863,603 > | 806,611,863,636 > | 806,644,863,669 > | 806,677,863,702 > | 806,710,863,735 >
Code: Select all
//Subroutine to find a text in a given table ------------------------------------------
//Const: BASE_DIRECTORY .- Directory where the macro has its files.
//Const: IMAGES_SUB_DIRECTORY .- Directory inside the BASE_DIRECTORY where the macro has the images to be searched for.
//Input: IMAGE_NAME .- Name of the Image with a pic of the header at the top of the column.
//Input: COL_WIDTH .- Width of the column in pixels.
//Input: ROW_HEIGHT .- Height of the row in pixels.
//Input: ROW_SKIP_PIXELS .- Number of Pixels to skip before finding the next row
//Input: FILE_LINE_INDEX .- See ReadFileVariable
//Outpt: FILE_VAR_TEXT .- See ReadFileVariable
//Outpt: X_CORD,X2_CORD .- Horizontal coordinates of the found item
//Outpt: Y_CORD,Y2_CORD .- Vertical coordinates of the found item
SRT>FindInTable
//Retrieve text to be found
Let>FILE_VAR_TEXT=30
ArrayCount>YArr,NUM_IMGS_FOUND
Let>ARR_IDX=0
Let>X_CORD=0
Let>Y_CORD=0
Let>VAR_LOG_FIND_IN_TABLE=...
//Find header
FindImagePos>%BASE_DIRECTORY%\%IMAGES_SUB_DIRECTORY%\%IMAGE_NAME%,SCREEN,0.7,3,XArr,YArr,NumFound,CCOEFF
IF>NumFound>0
While>ARR_IDX<15
Let>X_CORD=%XArr_0%
Let>Y_CORD={%ARR_IDX%*%ROW_HEIGHT%}
Add>Y_CORD,{%ARR_IDX%*%ROW_SKIP_PIXELS%}
Add>Y_CORD,%YArr_0%
Let>X2_CORD=%X_CORD%
Add>X2_CORD,%COL_WIDTH%
Let>Y2_CORD=%Y_CORD%
Add>Y2_CORD,%ROW_HEIGHT%
OCRArea>%X_CORD%,%Y_CORD%,%X2_CORD%,%Y2_CORD%,STR_OCR_RESULT
Let>VAR_LOG_FIND_IN_TABLE=%VAR_LOG_FIND_IN_TABLE% | %X_CORD%,%Y_CORD%,%X2_CORD%,%Y2_CORD% > %STR_OCR_RESULT%
Trim>%STR_OCR_RESULT%,STR_OCR_RESULT
//Message>|%STR_OCR_RESULT%| != |%FILE_VAR_TEXT%|
IF>STR_OCR_RESULT=FILE_VAR_TEXT
Goto>ContinueFindInTableNoError
EndIf
Let>ARR_IDX={%ARR_IDX%+1}
EndWhile
Endif
Let>ERROR_MESSAGE=The value %FILE_VAR_TEXT% was not found in the table. %VAR_LOG_FIND_IN_TABLE%
GoSub>ReportError
Label>ContinueFindInTableNoError
Let>ROW_SKIP_PIXELS=0
END>FindInTable
//Find the POS
//Outpt: X_CORD,X2_CORD .- Horizontal coordinates of the found item
//Outpt: Y_CORD,Y2_CORD .- Vertical coordinates of the found item
Let>IMAGE_NAME=pap_08_oc_pos_right_click.PNG
Let>COL_WIDTH=57
Let>ROW_HEIGHT=25
Let>FILE_LINE_INDEX=9
Let>ROW_SKIP_PIXELS=8
GoSub>FindInTable
Thank you!