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

  • Question

  • Hi All,

    I want  vb script to automate my client side application to read the text (OCR functionality) from a scanned PDF or Tiff file stored in a folder. No shell scripting please.

    We use Microsoft Office 2010 and it includes OneNote.

    Thanks


    Monday, December 8, 2014 7:58 PM

All replies

  • Hello Macro,

    I am not expert in using onenote and so i requested a sample script how to handle onenote OCR.

    Thanks

    Monday, December 8, 2014 8:15 PM
  • Prewritten scripts can be found in the repository:

    http://gallery.technet.microsoft.com/scriptcenter

    If you want help, you'll need to post your script and your errors before we can offer any assistance.


    Don't retire TechNet! - (Don't give up yet - 13,085+ strong and growing)

    Monday, December 8, 2014 8:17 PM
  • 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



    • Edited by TGChand Monday, December 8, 2014 8:50 PM
    Monday, December 8, 2014 8:48 PM
  • The code you posted is VBA, not VBScript; thus, you are not asking in the correct forum.

    -- Bill Stewart [Bill_Stewart]

    Monday, December 8, 2014 9:00 PM
    Moderator
  • Thanks will.. I will post in right forum.

    Monday, December 8, 2014 9:05 PM