Text on the screen

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

EnderFFX
Pro Scripter
Posts: 92
Joined: Mon Mar 08, 2004 6:17 am

Text on the screen

Post by EnderFFX » Mon Mar 08, 2004 6:20 am

How do I read the text from a specific location on the screen in a window? I figure this is either a really easy task or a really hard one.

Please help! All help appreciated!

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Mon Mar 08, 2004 7:38 am

Lots of variables, problems, solutions, etc.

Need more info to get started:
1. What program, version do you want to read text from? What window is open, what area do you need to get text from?
2. Provide/reference sample page, and provide specifie example.
3. What will you do with the results?
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Mar 08, 2004 1:23 pm

EnderFFX,

Your wish constitutes an enormous techcnial challenge. I would discourage you from pursuing the goal. It depends on whether is's an editable text or just an image. The latter involves optical character recognition. For some text such as system error messages and Adobe ebooks, it may look like a text, In fact, it disallows copying to clipboard.

In sum, it won't be a missiion accomplished within hours.

Lumumba

Post by Lumumba » Mon Mar 08, 2004 2:30 pm

Google for: "eventcorder suite"

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Mar 08, 2004 3:21 pm

Lumumba,

Thanks for introducing us another interesting product. Nonetheless, I just don't see how it's related to EnderFFX's wish to "read" text from a specific location. Anyway I try to figure out how Eventcorder Suite can be applied in my scripting. Thanks.

Lumumba

Post by Lumumba » Mon Mar 08, 2004 3:50 pm

If the text can't be captured to identify its "meaning" - let's check how it looks like. EC keeps an prerecorded image (ClickView) which will be compared at runtime, if condition has been met (image is identical), the following tasks will be executed.

Guess you could accomplish something equal by doing a screenshot and an afterwards binary compare (with a commandline tool which delievers an errorlevel) against a previous shot.

No idea if the above would take as long as GetRectCheckSum> ...

EnderFFX1

Reply

Post by EnderFFX1 » Mon Mar 08, 2004 5:50 pm

Bob Hansen wrote:Lots of variables, problems, solutions, etc.

Need more info to get started:
1. What program, version do you want to read text from? What window is open, what area do you need to get text from?
2. Provide/reference sample page, and provide specifie example.
3. What will you do with the results?
1) I am reading text from an online game.
2) It is a graphic page and a number appears on the screen and I am trying to grab that number
3) I need the results to put into an integer and add up.

The first thing I'm going to do now is just dump all the text from the screen to a message. If the numbers appear there I will attempt to do what I can, if not then I need to figure a way around this.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Tue Mar 09, 2004 1:07 am

Lumumba,
Thanks a lot for showing us a wonderful tool.

EnderFFX1,
Given your requirement description, it seems that an OCR tool is more appropriate for the job. Please google “OCR SDKâ€Â

Lumumba

Post by Lumumba » Tue Mar 09, 2004 8:29 am

If the "target" (numeric) character will appear always at the same position you could check that area for a trigger which is unique for a character.

:idea:

a lower left (and right!) pixel will only appear for the numeric character --> 2
a top left pixel will only appear for the numeric character --> 7
a mid left pixel will only appear for the numeric character --> 4

and so on ...

Train your brain :D

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Tue Mar 09, 2004 12:05 pm

If the text is not standard window control text then the only technique that can do what you want is optical character recognition (OCR). The portion of the screen must be grabbed to an image which is then analysed by the OCR engine for the text. A product that does this very well is Kleptomania. The makers of this offer an API and a command line interface allowing you to run this from Macro Scheduler for example. Details at http://www.structurise.com or search on Google.
MJT Net Support
[email protected]

Lumumba

Post by Lumumba » Tue Mar 09, 2004 3:10 pm

Done a quik check with MSPaint.

I've used character format: Courier/20/Western/Bold
So all characters are within a frame of 11x18 pixels

a) create this line in MSPaint (coloured red): 1 1 1 1 1 1 1 1 1 1
b) create that second line (coloured black): 1 2 3 4 5 6 7 8 9 0
c) cut the second (black) line and move it over the first (red) line as a top layer. (Image\Draw Opaque has to be disabled) so the first character 1 will fully match.

d) check for those parts of the bottom layer which are not covered by the top layer and find a "bottom layer pixel" which is only visible at that full matching character.

For the character 1 that "unique" pixel is at 6x7

Conclusio:

-----

//on a 11x18 screen :wink:
WaitPixelColor>0,6,7,1
If>WPC_RESULT=TRUE, HeurekaItsOne
.
.
.
Label>HeurekaItsOne

-----

Well, you wanna know the results for 2,3,4 ... Let>redline=2 2 2 2 2 2 2 2 2 2 Goto> a) :twisted:

Any more to say :roll:

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Wed Mar 10, 2004 12:47 am

:?: :?: How did this become a sticky? :?: :?:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Wed Mar 10, 2004 9:30 am

If you check that relevant area (@ which a numeric value should be displayed) about a pixel change (WPC) you should be able to trigger a specific character. If that sounds completly nuts, don't hesitate to complain 8)

User avatar
Bob Hansen
Automation Wizard
Posts: 2475
Joined: Tue Sep 24, 2002 3:47 am
Location: Salem, New Hampshire, US
Contact:

Post by Bob Hansen » Sat Mar 13, 2004 11:22 pm

:?: :?: How did this become a sticky? :?: :?:
Hope this was helpful..................good luck,
Bob
A humble man and PROUD of it!

Lumumba

Post by Lumumba » Tue Mar 16, 2004 10:58 am

Support, Marcus Tettmar - Bob is right, how this posting become a sticky :?: :?

Post Reply
cron
Sign up to our newsletter for free automation tips, tricks & discounts