Jump to content

Recommended Posts

Posted

It's work!!!

Even with jpg/bmp images!

Thanks a lot!

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

Posted

@ptrex

  Quote

Have a nice weekend !!

Thanks! And you to!

Here i made from this great work of yours somthing like UDF:

#include <Array.au3>

Global Const $miLANG_CZECH = 5
Global Const $miLANG_DANISH = 6
Global Const $miLANG_DUTCH = 19
Global Const $miLANG_ENGLISH = 9
Global Const $miLANG_FINNISH = 11
Global Const $miLANG_FRENCH = 12
Global Const $miLANG_GERMAN = 7
Global Const $miLANG_GREEK = 8
Global Const $miLANG_HUNGARIAN = 14
Global Const $miLANG_ITALIAN = 16
Global Const $miLANG_JAPANESE = 17
Global Const $miLANG_KOREAN = 18
Global Const $miLANG_NORWEGIAN = 20
Global Const $miLANG_POLISH = 21
Global Const $miLANG_PORTUGUESE = 22
Global Const $miLANG_RUSSIAN = 25
Global Const $miLANG_SPANISH = 10
Global Const $miLANG_SWEDISH = 29
Global Const $miLANG_TURKISH = 31
Global Const $miLANG_CHINESE_SIMPLIFIED = 2052
Global Const $miLANG_CHINESE_TRADITIONAL = 1028

Global $oMyError = ObjEvent("AutoIt.Error","OCRErrFunc")

$sArray = OCRGet("C:\Temp\Numbers.tif", $miLANG_ENGLISH)
ConsoleWrite(@error)

_ArrayDisplay($sArray, "OCR Result")


Func OCRGet($Image, $Lang=9)
    Local $sArray[1], $oWord
    
    Local $miDoc = ObjCreate("MODI.Document")
    $miDoc.Create($Image)
    If @error Then Return SetError(1)
    
    $miDoc.Ocr($Lang, True, False)
    If @error Then Return SetError(2)
    
    For $oWord In $miDoc.Images(0).Layout.Words
        ReDim $sArray[UBound($sArray)+1]
        $sArray[UBound($sArray)-1] = $oWord.Text
    Next
    $sArray[0] = UBound($sArray)-1
    Return $sArray
EndFunc

;------------------------------ This is a COM Error handler --------------------------------
Func OCRErrFunc()
  $HexNumber = hex($oMyError.number, 8)
  Msgbox(0,"COM Error Test","We intercepted a COM Error !"       & @CRLF  & @CRLF & _
             "err.description is: "    & @TAB & $oMyError.description    & @CRLF & _
             "err.windescription:"     & @TAB & $oMyError.windescription & @CRLF & _
             "err.number is: "         & @TAB & $HexNumber              & @CRLF & _
             "err.lastdllerror is: "   & @TAB & $oMyError.lastdllerror   & @CRLF & _
             "err.scriptline is: "     & @TAB & $oMyError.scriptline     & @CRLF & _
             "err.source is: "         & @TAB & $oMyError.source         & @CRLF & _
             "err.helpfile is: "       & @TAB & $oMyError.helpfile       & @CRLF & _
             "err.helpcontext is: "    & @TAB & $oMyError.helpcontext)
  SetError(1)  ; to check for after this function returns
Endfunc

 

  Reveal hidden contents

 

 

AutoIt is simple, subtle, elegant. © AutoIt Team

  • Moderators
Posted

Seems the size of the bmp/tif/whatever matters here... If your width and height of the pic isn't big enough, it throws errors... I haven't gotten the exact height needed yet specifically, but I know that 100 width and 12 height isn't working so well. Just an FYI for others, or if others haven't found that issue, maybe more of an eye opener for me :)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Posted (edited)

@all

I went already a bit further and threw in a VIEWER in the game.

See updated First post.

Just playing around, gives a lot a possibilties.

Making this all in a UDF is to premature I think

Regards,

ptrex

Edited by ptrex
Posted

  argumentum said:

How do you get the coordinates tuape ?

You an get all sorts of interesting details from the .Word object .. download Microsoft's standalone helpfile (CHM format) on the Object Model for full details.

Or you can browse it online

HTH

:)

Nice find ptrex!

  • 1 month later...
Posted

I installed all components of Office XP and there isn't a folder C:\Program Files\Common Files\Microsoft Shared\MODI or the MODI component in registry.

Is there another possibility to install this component?

10x

Strength is irrelevant. Resistance is futile. We wish to improve ourselves. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service ours.

Posted

Meantime I found the answer.

There is Microsoft Office Professional Plus! 2007.

Strength is irrelevant. Resistance is futile. We wish to improve ourselves. We will add your biological and technological distinctiveness to our own. Your culture will adapt to service ours.

Posted (edited)

this would be good in a func like PixelChecksum

ORC( left, top, right, bottom, $colour)

$colour being the colour the text is in

Edited by thenewkid

some of my scripts check them out and give feedback so i can learn from them :)autoclicker a autoclickernote taker a script to take notes with

Posted

Hi!

  LordWinter said:

I installed all components of Office XP and there isn't a folder C:\Program Files\Common Files\Microsoft Shared\MODI or the MODI component in registry.

+1

When I search, I find that Office installed the component "Office-Imaging", to make OCR. But, no trace of MODI.

I use Office-XP-professional-French.

Any idea?

  • 2 weeks later...
Posted

Hi!

  ptrex said:

I am not sure it is available using Office XP ?

I only found 2003 and higher examples.

If I find something I'll let you know.

Drop! I have, now, Vista Ultimate + Office-2007. And, your script run OK.

Posted

Tested on Windows Vista with Office 2007. It works great!.

I'm only asking how to authorize the compiled exe in order to avoid these annoying warning security dialogs.

Thank you very much for sharing.

Roy.

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
  • Recently Browsing   0 members

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