locked
How to Return text from scanned TIFF file using OneNote (OCR) - VB Script RRS feed

  • Question

  • Hi

    At present we are using MODI but its not working on windows 2008 (64Bit) and so we are planning to use OneNote. Also we use lotus notes script its similar to vb script.

    The below code calls MODI object and reads the tiff file to return the text. It works fine.

    Sub Initialize
    Dim modi As Variant
    Dim xfile As String
    On Error GoTo errhandler
    Set modi = CreateObject("MODI.Document")

    file = "C:\Lab\abc.tiff"
    Call modi.Create(xFile)
    Call modi.OCR()

    For imageCounter = 0 To (modi.Images.Count - 1) ' work your way through each page of results
    strRecText = modi.Images(imageCounter).Layout.Text    ' this puts the ocr results into a string
    Next
    Msgbox strRecText
    Call modi.Close()
    Set modi = Nothing

    Exit Sub
    errhandler:
    msgbox "Got error " & Error$ & " on line " & CStr(Erl)

    End Sub

    Here is my onenote script, trying to achieve similar to modi but no luck :

    Sub Initialize
    On Error GoTo errhandler

    Dim onenote As Variant
    Dim xfile As String
    Dim imageCounter As Integer
    Dim strRecText As string
    Set onenote = CreateObject("OneNote.Application")

    xfile = "C:\Lab\abc.tiff"
    Call onenote.Create(xfile)
    Call onenote.OCR()

    For imageCounter = 0 To (onenote.Images.Count - 1) ' work your way through each page of results
    strRecText = onenote.Images(imageCounter).Layout.Text    ' this puts the ocr results into a string
    Next
    MsgBox strRecText
    Call onenote.Close()
    Set onenote = Nothing

    Exit Sub
    errhandler:
    MsgBox "Got error " & Error$ & " on line " & CStr(Erl)

    End Sub
    Monday, December 8, 2014 9:07 PM