Jump to content

Real OCR in AU3 - in a few lines.


ptrex
 Share

Recommended Posts

CAN YOU PLEASE HELP ME?

Do you have Proper software installed? It requires the MODI software part of Office. Some people have said the link in this post gets them rolling. I had to go into the Office Add/Rem wizard and be sure that Office Document Imaging was enabled under Office Tools. Hope that helps. Edited by spudw2k
Link to comment
Share on other sites

  • 1 month later...

Hi, is this an old script ? Do I have to convert to the new one ? I got these errors :

(40,42) : WARNING: $WS_OVERLAPPEDWINDOW: possibly used before declaration.

$WS_OVERLAPPEDWINDOW +

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

(40,56) : WARNING: $WS_VISIBLE: possibly used before declaration.

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE +

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

(40,74) : WARNING: $WS_CLIPSIBLINGS: possibly used before declaration.

$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS)

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

(40,42) : ERROR: $WS_OVERLAPPEDWINDOW: undeclared global variable.

$WS_OVERLAPPEDWINDOW +

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^

- 1 error(s), 3 warning(s)

!>05:50:18 AU3Check ended.rc:2

+>05:50:19 AutoIt3Wrapper Finished

>Exit code: 0 Time: 1.131

Edited by trinitrotoluen
Link to comment
Share on other sites

  • 2 weeks later...

You should try to delete these and then run it again - it should work.

_$WS_OVERLAPPEDWINDOW + $WS_VISIBLE + $WS_CLIPSIBLINGS

P.S. Ptrex, this is amazing. I never knew that Office came with scriptable OCR. I was skeptical that it would work - but I tested it on a PDF that I converted to Tiff and it got every word. Thank you for the post.

Build your own poker game with AutoIt: pokerlogic.au3 | Learn To Program Using FREE Tools with AutoIt

Link to comment
Share on other sites

Link to comment
Share on other sites

Would this be possible in Office 2007?

http://www.autoitscript.com/forum/index.php?showtopic=50608&view=findpost&p=684976

How can I use it ?

Check this out for some ideas. #629661 Edited by spudw2k
Link to comment
Share on other sites

Hi,spudw2k

Sorry I can't understand you.

I copied and pasted the image with full of texts on Microsoft Office Document Imaging but always got this error when I used OCR :

OCR was not successful (no text was found) on one or more pages.

I use directly Microsoft Office Document not through AutoIT code.

Edited by trinitrotoluen
Link to comment
Share on other sites

Hi,spudw2k

Sorry I can't understand you.

I copied and pasted the image with full of texts on Microsoft Office Document Imaging but always got this error when I used OCR :

I use directly Microsoft Office Document not through AutoIT code.

I've never used any MODI interface but the code presented in this thread. Sorry for the confusion.
Link to comment
Share on other sites

  • 2 weeks later...

This is a very interesting thread, and I could use something like this, if that is I had the know how.

Anyway, before I satart looking to install office or try to grasp this concept may I ask a couple of questions ?

Firstly, I read this thread and noticed people talking about reading pages of stuff, My question is this...

...Would if be able to read just a single charactor ?

eg. Posted Image (this is a .jpg, although the image I would want it to read would most likely be .tif)

Secondly, could it read it directly off the screen or does it need to save an image and read it from that image ?

Appreciate any answers

John

Edited by JohnOne

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

anyone having problem getting the script to work in windows 7 with office 2007. i have modi installed and it's working cuz i can use the modi gui to test it out. but it keeps throwing error at line 37 where it creates the modi.document object.

Link to comment
Share on other sites

Finally got this to work, its quite good, thanks.

I wonder though, when it reads a tif file it throws up a viewer which you have to close to get resuls, but when reading a bmp file it just throws up the results.

Anyone trying to still run this, All I installed out of office 2007 was micrsoft office tools, no word,exel,access etc, just the tools.

AutoIt Absolute Beginners    Require a serial    Pause Script    Video Tutorials by Morthawt   ipify 

Monkey's are, like, natures humans.

Link to comment
Share on other sites

  • 4 weeks later...

I've been using a modified version of this source code, with a screenshot capture program for a while and it works. However, has Ptrex or anyone noticed that the modi capture seems to have a border of 'accuracy' around it? That is, numbers or words around the edge of the image itself doesn't capture accurately sometimes? I am working with a list of items, and sometimes a word will be closer to the edge and therefore the capture isnt as accurate - any thoughts or fixes on this?? If you do please msg me.

Link to comment
Share on other sites

  • 1 year later...

ptrex, you are da bomb! Your script is most helpful--both in its simplicity and for its educational content (for me at least.)

I had to make an edit to make it work under the newer version of AutoIT, but it worked fine.

Note to anyone looking to convert MDI files to TIFF (since Office 2010 doesn't have Microsoft Office Document Imaging): the COM object model will work for conversions. Must have a machine with MODI on it of course, but using the MSDN documentation and some edits to this script it can be done very simply. (See http://msdn.microsoft.com/en-us/library/aa202834(v=office.11).aspx)

Thank you, ptrex. You've saved me a lot of time, and possibly my company a lot of money. (We'll have to wait and see about the money part.)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...