Text on the screen
Moderators: JRL, Dorian (MJT support)
Text on the screen
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!
Please help! All help appreciated!
- Bob Hansen
- Automation Wizard
- Posts: 2475
- Joined: Tue Sep 24, 2002 3:47 am
- Location: Salem, New Hampshire, US
- Contact:
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?
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!
Bob
A humble man and PROUD of it!
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.
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.
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> ...
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> ...
Reply
1) I am reading text from an online game.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?
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.
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.
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

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

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]
[email protected]
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
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)
Any more to say
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

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)

Any more to say

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