This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

VBScript to perform OCR Operation

Former Member
Former Member

This is the vbscript from the partner portal to be used in a workflow. What am I missing? I receive the error message that the definition of the state is invalid, Expected end of statement. 

Option Explicit
' Prepare the files of the object for modification by script.
Dim files
Set files = Vault.ObjectFileOperations.GetFilesForModificationInEventHandler( ObjVer )
' Prepare OCR options.
Dim opts
Set opts = CreateObject( "MFilesAPI.OCROptions" )opts.PrimaryLanguage = MFOCRLanguageEnglishUS
' Perform OCR on each of the convertible files.
Dim file
For Each file In files
' Is the file in a convertible file format?
If file.Extension = "tif" Or _
file.Extension = "tiff" Or _
file.Extension = "jpg" Or _
file.Extension = "jpeg" Or _
file.Extension = "pdf" Then
' Convert this file to searchable PDF.
Vault.ObjectFileOperations.PerformOCROperation ObjVer, file.FileVer, _opts, MFOCRZoneRecognitionModeNoZoneRecognition, Nothing, True
End If
Next

Parents
  • The error message tells you in which line the error is to be found.
    Most likely you are missing a line break in:
    Set opts = CreateObject( "MFilesAPI.OCROptions" )opts.PrimaryLanguage = MFOCRLanguageEnglishUS
    It should be:
    Set opts = CreateObject( "MFilesAPI.OCROptions" )
    opts.PrimaryLanguage = MFOCRLanguageEnglishUS

    Please don't ask the same question in multiple places in the forum.....

Reply
  • The error message tells you in which line the error is to be found.
    Most likely you are missing a line break in:
    Set opts = CreateObject( "MFilesAPI.OCROptions" )opts.PrimaryLanguage = MFOCRLanguageEnglishUS
    It should be:
    Set opts = CreateObject( "MFilesAPI.OCROptions" )
    opts.PrimaryLanguage = MFOCRLanguageEnglishUS

    Please don't ask the same question in multiple places in the forum.....

Children
No Data