extract text from picture

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Machariel
Newbie
Posts: 15
Joined: Mon Mar 10, 2008 8:40 pm

extract text from picture

Post by Machariel » Tue Mar 11, 2008 12:58 am

Hi. I need to copy text from one place to another in the same window. But I can see that the source area is not plain text you can just copying by right clicking mouse and paste it some where else.. It is a more like a part of the program somehow.
I need the macro to identify it as text and pass it somewhere else as real text.
But how ??
________
vaporizers
Last edited by Machariel on Tue Feb 01, 2011 11:34 pm, edited 1 time in total.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Mar 11, 2008 10:05 am

You may be able to use the text capture commands (GetTextAtPoint, GetTextInRect, GetWindowTextEx). Try the example to see if the text you want can be captured:

http://www.mjtnet.com/blog/2008/01/03/s ... e-example/

If the text is actually part of an image then you're probably out of luck unless you are prepared to try using OCR:

http://www.mjtnet.com/forum/viewtopic.php?t=4147
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

Machariel
Newbie
Posts: 15
Joined: Mon Mar 10, 2008 8:40 pm

Post by Machariel » Tue Mar 11, 2008 2:32 pm

just now tryed the capture text commands, and it can't see eanything at all in the program window.. And I don't think OCR will work either as I have read it only works on .gif and .tiff pictures. And don't think it is pictures at all, but somehow part of the interface. I have found out that the program is developed in Python Programming Language.
How to extract readable text from that ?
________
justin bieber fan
Last edited by Machariel on Tue Feb 01, 2011 11:34 pm, edited 1 time in total.

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Tue Mar 11, 2008 2:35 pm

OCR can be performed against BMP files. You can capture the screen to a BMP file. Therefore you can OCR the screen. The above link shows a script which uses the Microsoft Office OCR engine to do just that.

I don't know whether/how text from Python apps can be captured.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

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