Sign in to follow this  
Followers 0
randd

Reading text out of graphics

5 posts in this topic

Ok, I've searched the forums and haven't found the answer yet so I'm going to make my first time post. I'm looking for hints and general directions. Pointing me to particular resources would be a great help.

Anyway, I use autoit to perform some administrative tasks. One task in particular is java based app that I use to generate reports from.

My problem is that the section that I need to use to create these particular reports doesn't accept the {ENTER} key to open the report. {ENTER} just runs down through the ten reports with each enter going to the next report and selecting it, not actually opening it. No problem, you say, just get the mouse coords and you're done. Well, the problem is that I have ten possible reports but I only need to print two. The two reports both start with the same thing (SNMP - yep, reports on SNMP traps and requests). Because the software is written in java I can't use the AU3 spy utility to gather any useful information besides the window title which I've already got. Focus on the correct report is my problem.

I started looking around and found that Larry has written a function (Pixel Rect?) that can set up a nifty little rectangle based on given coordinates. So I figured that there must be some way for autoit to perform a kind of OCR to get the text from the rectangle area (which is kinda like a bitmap because it's in a java window and autoit doesn't understand it like a normal windows window). The text color is always black and the background is always purple (;>>>>>>>>>>>>>( Pixel Color Under Mouse)<<<<<<<<<<<<<

;Dec: 16764108 Hex: 0xFFCCCC).

Thanks in advance!


Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.

Share this post


Link to post
Share on other sites



I've seen some links to OCR utilities, but haven't played with any yet. Try some download sites and see if they have anything useful .. Google for +OCR Download free.

Alternatively: for a predefined font and size, i imagine you could write a script to learn the alphabet, and cook up your own OCR .. :D hmmm .. this sounds like a fun project actually!

Thinking aloud .. perhaps 2 scripts:

Script-1 could populate a database (ini file?) with pixel coords per character - based on a given font/size sample of all characters and numbers in, say, notepad.

Script-2 uses this database to build strings with characters that match a given area of the screen. You could return strings that are found, along with the pixel coords for each line; or maybe you could search for a specific string, returning pixel coords for targets found.

HTH :huh2:

Share this post


Link to post
Share on other sites

Really funny: I already do this some time ago. Mainly conceptual, this function works only with the MS Sans Serif font, 8pt size (windows default), and don't differ some symbols (big i and small L). If you need it I can post this today evening.

If you could post the code that would be great. I'd love to see how it's done.

Raoul S. Duke: Few people understand the psychology of dealing with a highway traffic cop. Your normal speeder will panic and immediately pull over to the side. This is wrong. It arouses contempt in the cop-heart. Make the bastard chase you. He will follow.

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0