Jump to content

Recommended Posts

Posted

I for the life of me can not get this to work. I've installed everything related to the MODI.

I'm currently getting an error at lines 48 and 49 before the GUI opens. When I close the window, I have a couple errors at line 68 before the ArrayDisplay.

Line 48: $miDoc.Create("C:\WINXP\Fonts\TIMES.TTF")

Line 49: $miDoc.Ocr($miLANG_ENGLISH, True, False)

Line 68: For $oWord in $miDoc.Images(0).Layout.Words

Line 69: $str = $str & $oWord.text & @CrLf

Line 70: ConsoleWrite($oWord.text & @CRLF)

Line 71: $sArray [$i] = $oWord.text

Line 72: $i += 1

Line 73: Next

I haven't made any changes to the original script from the first post except for in line 48, the font.

Any help would be greatly appreciated. I've been working on this for a couple days now.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Posted

I for the life of me can not get this to work. I've installed everything related to the MODI.

I'm currently getting an error at lines 48 and 49 before the GUI opens. When I close the window, I have a couple errors at line 68 before the ArrayDisplay.

Line 48: $miDoc.Create("C:\WINXP\Fonts\TIMES.TTF")

Line 49: $miDoc.Ocr($miLANG_ENGLISH, True, False)

Line 68: For $oWord in $miDoc.Images(0).Layout.Words

Line 69: $str = $str & $oWord.text & @CrLf

Line 70: ConsoleWrite($oWord.text & @CRLF)

Line 71: $sArray [$i] = $oWord.text

Line 72: $i += 1

Line 73: Next

I haven't made any changes to the original script from the first post except for in line 48, the font.

Any help would be greatly appreciated. I've been working on this for a couple days now.

What happens if you change Line 48 to

$miDoc.Create("::{D20EA4E1-3957-11d2-A40B-0C5020524152}" & "\Times.ttf")

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Posted (edited)

Here are the errors in order.

---------------------------

COM Error Test

---------------------------

We intercepted a COM Error !

err.description is: File is empty or corrupted

err.windescription: 1ED9}\TreatAs

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: 49

err.source is:

err.helpfile is:

err.helpcontext is: 0

---------------------------

OK

---------------------------

---------------------------

COM Error Test

---------------------------

We intercepted a COM Error !

err.description is: EP_E_DCOM_CORE_CREATENUM

err.windescription: ‰홸‰ㆽ矄8

err.number is: 80020009

err.lastdllerror is: 0

err.scriptline is: 50

err.source is:

err.helpfile is:

err.helpcontext is: 0

---------------------------

OK

---------------------------

---------------------------

COM Error Test

---------------------------

We intercepted a COM Error !

err.description is: Catastrophic failure

err.windescription: Variable is not of type 'Object'.

err.number is: 000000A9

err.lastdllerror is: 0

err.scriptline is: 69

err.source is:

err.helpfile is:

err.helpcontext is: 0

---------------------------

OK

---------------------------

---------------------------

COM Error Test

---------------------------

We intercepted a COM Error !

err.description is: Catastrophic failure

err.windescription: Variable is not of type 'Object'.

err.number is: 000000A9

err.lastdllerror is: 0

err.scriptline is: 69

err.source is:

err.helpfile is:

err.helpcontext is: 0

---------------------------

OK

---------------------------

All of the line numbers have increased by one due to adding the prior suggestion, it has been commented out though.

Edited by strate
INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
Posted

@strate

If the script stops at line 48, the main reason will be that :

1. the TIFF file does NOT exist BEFORE running the script.

2. or the PATH cannot be found by the script.

I see that you don't use the default %Windir% location of a standard XP installation.

Because your PathName is "WINXP" and should be in a standard installation "Windows"

Therefor you can do 2 ways. Try to move the file you are trying to scan into the Script location and try again.

Or replace the Path in the script by %WINDIR%\Fonts

Regards,

ptrex

Posted

Well, I'm a fool, thanks. I googled other MODI.Create statements and found that in the rush and excitement of trying this script that I changed that I thought the image to scan was supposed to be a font file.

Needlessly it's working now.

INI TreeViewA bus station is where a bus stops, a train station is where a train stops. Onmy desk I have a work station...
  • 3 weeks later...
Posted

Ptrex,

I'm getting a error on line# 50

$miDoc.Ocr($miLANG_ENGLISH, True, False)

Any advice/help?

[font="Verdana"]Valik:Get it straight - I'm not here to say please, I'm here to help - if my help's not appreciated then lotsa luck, gentlemen.[/font]

Posted

Ptrex,

I'm getting a error on line# 50

$miDoc.Ocr($miLANG_ENGLISH, True, False)

Any advice/help?

I'm getting an error at the same line. I'm using trdis' modification with Minicap, so I posted here in his thread asking about the error.
Posted

@All

Who have Errors ?!

I ran the example script from the first page, and everything works fine, under this condition.

The CREATE method DOES NOT CREATE ANYTHING.

You need to make sure that the fill you are scanning is in that location.

$miDoc.Create("C:\Temp\Test.tif")

Confusion, I know but that how MS has created it, I can't help it.

regards

ptrex

Posted

I traced the problem I was having to Minicap saving the screenshot as a rather small image, I think. When I took a screenshot manually and cropped it the OCR worked fine.

SmOke_N suggested modifying _Screen_Capture.au3; I'm going to try that now and see if I can get good results.

  • 1 month later...
Posted

Thanks, this is great. These additions/changes made it more user friendly for me:

$FilePath = FileOpenDialog("Select the new file", "", "All files (*.*)", 1) ;browse for the image file

If @error Then

MsgBox(4096,"","No File chosen")

exit

EndIf

$miDoc.Create($FilePath)

  • 1 month later...
Posted

this a function made with your source :)

All credits are for you Ptrex

#include <GUIConstants.au3>
    #include <Array.au3>
    #include <GuiConstantsEx.au3>
    #include <GDIPlus.au3>
    #include <ScreenCapture.au3>
    #include <WinAPI.au3>


;~ Dim $test
;~ $test=OCR_Region(0,0,@DesktopWidth,@DesktopHeight)
;~ _ArrayDisplay($test,"result")
;~
;~
;~
;~
;~
;~

Func OCR_Region($x,$y,$width,$height)
    Opt('MustDeclareVars', 1)
    Dim $miDoc, $Doc
    Dim $str
    Dim $oWord
    Dim $sArray[500]
    Dim $oMyError
    Dim $HexNumber
    Dim $msg
    Dim $i

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

    Local $hBitmap1,$hImage1,$temp
    $temp=@ScriptDir & "\temp.bmp"
    _GDIPlus_Startup ()
    ; Capture screen region
    $hBitmap1 = _ScreenCapture_Capture ("",$x, $y, $width, $height)
    $hImage1 = _GDIPlus_BitmapCreateFromHBITMAP ($hBitmap1)
    _GDIPlus_ImageSaveToFile ($hImage1, $temp)
    _GDIPlus_ImageDispose ($hImage1)
    _WinAPI_DeleteObject ($hBitmap1)

    ; Initialize error handler
    $miDoc = ObjCreate("MODI.Document")
    $miDoc.Create($temp)
    $miDoc.Ocr($miLANG_FRENCH, True, False)

    $i = 0
        For $oWord in $miDoc.Images(0).Layout.Words

            $str = $str & $oWord.text & @CrLf
                ConsoleWrite($oWord.text & @CRLF)
            $sArray [$i] = $oWord.text
            $i += 1
        Next
    FileDelete($temp)
    Return $sArray
EndFunc
  • 4 months later...
Posted

Hi everybody,

The script doesn't work on my pc. Studing the problem with "OLE/COM Objet Viewer" tool I found the "Microsoft Office Document Imaging Application", but when I try to see more details about it, a popup message notifies me that "CoGetClassObject failed. <no system message defined> REGDB_E_CLASSNOTREG ($80040154)".

Will you help me, please?

p.s.:

please be patience with me for two reasons:

a - I'm just a newbie

b - My English is very bad!!!

Posted

Hi everybody,

The script doesn't work on my pc. Studing the problem with "OLE/COM Objet Viewer" tool I found the "Microsoft Office Document Imaging Application", but when I try to see more details about it, a popup message notifies me that "CoGetClassObject failed. <no system message defined> REGDB_E_CLASSNOTREG ($80040154)".

Will you help me, please?

p.s.:

please be patience with me for two reasons:

a - I'm just a newbie

b - My English is very bad!!!

I Anyway continue to have the same problem... The script returns an error: it can't create the object "MODI.document".

Regards

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...