luddie 10 Posted May 18, 2016 (edited) Hello Lovely scar community! I am trying to use the ocr functionality of scar, but for some reason I can't get it to work. I type the text 'what' in word with verdana font size 22 and not bold etc.. But SCAR says it cannot find it and returns 'FAIL'. Does somebody know why this is and what I'm doing wrong? Any help is hugely appreciated. program OCR;varx,y,c : Integer;Found:Boolean;beginc := LoadCharsFromFont2('Verdana', 22, False, False, False, False); Found:= IsTextInAreaEx(0, 0, 1300,700, x, y, 'what', 5, c, True, True, 0, 0, -1) if (Found=True)thenWriteLn('Found');if (Found=False)thenWriteLn('FAIL');end. Edited May 18, 2016 by luddie Quote Share this post Link to post Share on other sites
Kavex 11 Posted May 18, 2016 If you print out the Boolean what does it return? I'm guessing a 0 Quote Share this post Link to post Share on other sites
luddie 10 Posted May 18, 2016 Yes, then it returns value 0. So it is not finding the text. Quote Share this post Link to post Share on other sites
Wanted 12 Posted May 18, 2016 function IsTextInAreaEx(x1, y1, x2, y2: Integer; var x, y: Integer; S: string; Tolerance: Integer; Chars: Integer; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer): Boolean; Searches for text in area specified by x1, y1, x2, y2. Other parameters match IsTextAtEx. Change your Max spacing to more than 0 (1-10), CheckShadow and Check outline to false, try using exact color instead of -1.. search area looks pretty large.. maybe try to narrow that down as well. Eliminate and rule out which inputs are causing failure. More guidelines from old manual Checks if text specified by S is at location specified by x, y. Tolerance specifies acceptable color range in case characters are not completely monochrome, Chars specifies font number returned by LoadChars2 or LoadCharsFromFont2, CheckShadow specifies whether function should look for shadow, CheckOutline specifies whether function should verify if character borders are correct, MinSpacing and MaxSpacing are RS1 and RS2 specific parameters for text with changing spacing between characters, in other cases use MinSpacing=0 and MaxSpacing=0, TextColor specifies text color, if set to -1, will search for text in any color. Quote Share this post Link to post Share on other sites
luddie 10 Posted May 19, 2016 Ye I learned the function from the old manual. When I put the CheckShadow and check outline to false it finds my text, at least I thought it was. But when I put the color to 0 (since my text in word is black) it does not find my text anymore. So even with color to -1 it does not actually find my text, but something weird that looks like my text in another color. How do i know which input is causing failure? I tried adjusting all of them and it never finds the text except with color -1 and even then it does not find the text, because the x,y values are not those were the text is... Can you test this script see if it works for you with a word text? Quote Share this post Link to post Share on other sites