SRL Archive - General

Scar Text Reading Capability


yamaha317

2011-03-02 20:44:06

Can Scar read text off of… lets say a notepad or another window?

I know there are functions to take text off of websites through html, but that will not help here.

What I would like to do is have scar read text from one window and re-type it using typesend(); I do not want it to use Ctrl+C and Ctrl+V or any variation of copy/paste.

Anyone have ideas?

Wanted

2011-03-02 21:23:06

Should be easy, view your SCAR manual for OCR functions to pick up any font that you can load with a (.tff? .ttf?)

yamaha317

2011-03-02 21:39:48

From: IceFire908
Should be easy, view your SCAR manual for OCR functions to pick up any font that you can load with a (.tff? .ttf?)


Thank you, so far I have noticed these two functions may work well for this task.


function LoadCharsFromFont2(fontname: string; fontsize: Integer; fontbold, fontitalic, fontunderline, fontstrike: Boolean):

function GetTextAtEx(x, y: Integer; Tolerance: Integer; Chars: Integer; CheckShadow, CheckOutline: Boolean; MinSpacing, MaxSpacing: Integer; TextColor: Integer; TextLength: Integer; Strict: Boolean; Range: TCharRange)

I was wondering where GetTextAtEx stores the variable… I'm having a moment of stupidity..

Wanted

2011-03-02 21:41:41

It's the function result.

S := GetTextAtEx(….);

yamaha317

2011-03-02 22:01:27

From: IceFire908
It's the function result.

S := GetTextAtEx(….);


So this is what I have so far.

program New;

Var
FONT:integer;
TYPE1:string;

begin
FONT := LoadCharsFromFont2('Courier New', 8, False, False, False, False);
Writeln('waiting');
Wait(2000);
TYPE1 := GetTextAtEx(200,120,130,FONT,False,False,0,0,-1,50,False,tr_AllChars);
Writeln(TYPE1);
end.

and this is the error I am getting

Successfully compiled (81 ms)
[Runtime Error] : Exception: Access violation at address 007877A7 in module 'scar.exe'. Read of address 00000000 in [B]line 8[/B] in script C:\Desktop\Text ID.scar

Wizzup?

2011-03-03 03:54:10

It is possible to read from other windows, but not particularly easy. Especially since I assume you'll also want to target the window AND the script.

Here is a guide to the OCR, including proper font loading. You should be able to use the font with GetTextAt / GetTextAtEx.

http://docs.wizzup.org/simba/scriptref/ocr.html

E: Didn't see it was for SCAR. Moved to the appropriate section.