Jump to content

MODI OCR memory issue


Recommended Posts

Hello I'm new to the forums and have been doing my best avoiding posting stupid questions. I've learned a ton just from reading, and have made a lot of progress I wouldn't have thought I could achieve on my own. In any case though I am stuck and hopeful for help.

I am running a script that uses MODI OCR several times in different functions. Each function works when tested independently, but when put together the script eventually crashes due presumably to a memory error. I am using the MODI.close property but from what I understand it doesn't work perfectly. I know AutoIt doesn't have any garbage collection, so I am stuck looking for a way to force it.

My question is this, if I know that a COM object is not properly releasing memory, is there a way to force it to do so beyond the ways I have tried? The code is listed below, and thanks for any help.

Func OCR($filename)
    $miDoc = ObjCreate("MODI.Document")
    $miDoc.Create($filename)
    $miDoc.Ocr($miLANG_ENGLISH, True, False)
    For $oWord in $miDoc.Images(0).Layout.Words
        $miWord = $oWord.text
        $str = $str & $oWord.text
        $TempArray[$h] = $miWord
        $h = $h + 1
    Next
    $miDoc.Close
    $miDoc = 0
    $filename = 0
    $h = 0
EndFunc
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...