Skip to main content
Kofax

VB.NET Recognition Script sample for assigning a default Form Type if Form Type not detected

18688

QAID # 18688 Published 

Question / Problem:

Is there a VB.NET Recognition Scripting sample that demonstrates how to identify one or more known Form Types, and if not detected returns a default Form Type?

Answer / Solution:

The following example is intended to work only for Batches having only single page Documents. There really is no method for identifying multiple pages for Documents in a Batch if one of the Documents is to be identified based on a missing feature, such as a bar code or the like.

  1. Create the Document Classes and define Form Types and a Sample Page for each.
  2. Define a Form Identification Zone on each Sample Page.
  3. Open the Properties of a Form ID Zone. Set the Confidence slider to zero and enter the Search Text.For this example, we are setting the Search Text to "Test1", "Test2" and "Default1" for the three zones in the Form Types.
  4. Click the Edit button to open the Recognition Profiles dialog, then press the "Save As" button and enter the name of the new Profile.
  5. Press the "script" button, select VB.NET as the language, and Create the new script.
  6. For Visual Studio, below is the source code example to identify the Form Types and return specific Search Text values:
Imports System
Imports System.Collections.Generic
Imports System.Text
Imports Kofax.AscentCapture.Scripting
Imports Kofax.AscentCaptureModule
Namespace DefaultFormRec
    Public Class DefaultFormRec
            Inherits RecognitionScript
        Private Sub DefaultFormRec_RecognitionPostProcessing(sender As Object,
                                e As Kofax.AscentCapture.Scripting.PostRecognitionEventArgs)
                                Handles Me.RecognitionPostProcessing
        Select Case e.SearchText
            Case "Default1"
                e.Confidence = 75
                e.Value = e.SearchText
            Case Else
                Select Case e.Value.ToLower()
                    Case "northwest", "tri-spectrum"
                        e.Value = e.SearchText
                        e.Confidence = 100
                    Case Else
                        e.Value = ""
                        e.Confidence = 0
                    End Select
            End Select
        End Sub
    End Class
End Namespace
  1. For each of the other Form Types, assign each to use the same profile saved in Step 4. Set their respective Search Text values.
  2. In the Batch Class Properties ¦ Separation and Form Identification tab, select "Custom."
  3. Select "Edit Profile," then in the dialog, select "Save As," enter a name for the profile and Save.

Applies to:

Product Version
CAPTURE 10.0
  10.1
  10.2
  11.0

Keywords: Form Type, Default Form Type

  • Was this article helpful?