Skip to main content

Recognition Script to Select Form Type


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 Kofax.AscentCapture.NetScripting
Imports Kofax.Capture.CaptureModule.InteropServices
Imports System
Imports System.Collections.Generic
Imports System.Text

Namespace Northwest
    Public Class Northwest
        Inherits RecognitionScript

        Private Sub Northwest_RecognitionPostProcessing(sender As Object, e As 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 Category
Kofax Capture 10.x, 11.x Scripting


  • Was this article helpful?