Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- function FindTextIn(var x, y: Integer; text: string; font: Integer; color, tolerance, XS, YS, XE, YE: Integer): Boolean;
- var
- bmp: TSCARBitmap;
- begin
- bmp := CreateBitmapFromText(text, font, color);
- bmp.TranspColor := 0;
- Result := FindBitmapTol(x, y, bmp, XS, YS, XE, YE, tolerance);
- bmp.Free;
- end;
- function FindText(var x, y: Integer; text: string; font: Integer; color, tolerance: Integer): Boolean;
- var
- bx: TBox;
- begin
- bx := GetClient.ImageArea;
- Result := FindTextIn(x, y, text, font, color, tolerance, bx.X1, bx.Y1, bx.X2, bx.Y2);
- end;
- var
- x, y, font: Integer;
- begin
- ClearDebug;
- font := LoadCharsFromFont2('Arial', 10, False, False, False, False);
- if FindText(x, y, 'YOUR TEXT HERE', font, clWhite, 0) then
- WriteLn('Found text at ' + IntToStr(x) + ', ' + IntToStr(y));
- FreeChars2(font);
- end.
Advertisement
Add Comment
Please, Sign In to add comment