Janilabo

Untitled

Apr 1st, 2013
54
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Pascal 0.84 KB | None | 0 0
  1. function FindTextIn(var x, y: Integer; text: string; font: Integer; color, tolerance, XS, YS, XE, YE: Integer): Boolean;
  2. var
  3.   bmp: TSCARBitmap;
  4. begin
  5.   bmp := CreateBitmapFromText(text, font, color);
  6.   bmp.TranspColor := 0;
  7.   Result := FindBitmapTol(x, y, bmp, XS, YS, XE, YE, tolerance);
  8.   bmp.Free;
  9. end;
  10.  
  11. function FindText(var x, y: Integer; text: string; font: Integer; color, tolerance: Integer): Boolean;
  12. var
  13.   bx: TBox;
  14. begin
  15.   bx := GetClient.ImageArea;
  16.   Result := FindTextIn(x, y, text, font, color, tolerance, bx.X1, bx.Y1, bx.X2, bx.Y2);
  17. end;
  18.  
  19. var
  20.   x, y, font: Integer;
  21.  
  22. begin
  23.   ClearDebug;
  24.   font := LoadCharsFromFont2('Arial', 10, False, False, False, False);
  25.   if FindText(x, y, 'YOUR TEXT HERE', font, clWhite, 0) then
  26.     WriteLn('Found text at ' + IntToStr(x) + ', ' + IntToStr(y));    
  27.   FreeChars2(font);
  28. end.
Advertisement
Add Comment
Please, Sign In to add comment