Skip to content

Instantly share code, notes, and snippets.

Private Sub SL_SuppressOCRToggleOFF_LocateAlternatives(ByVal pXDoc As CASCADELib.CscXDocument, ByVal pLocator As CASCADELib.CscXDocField)
On Error GoTo ErrorHandler
oLog.Debug "***** SL_SuppressOCRToggleOFF_LocateAlternatives Started *****"
' SCNS0122 - OCR Suppression
' For PIP & PTP, SuppressOCR will be true if a known barcode was detected during EDRMS Master. This will have been set during Document_BeforeProcessXDoc.
' Here, we must temporarily disable SuppressOcr.
Select Case Global_MET12_BusinessUnitID
@RNJarvis
RNJarvis / DetectBarcodes.vb
Created February 6, 2020 16:35
Detect Barcodes in KTM using different methods, all calling a barcode locator in a different way.
Public Sub edrmsDetectKnownBarcodes(ByVal pXRootFolder As CASCADELib.CscXFolder)
On Error GoTo ErrorHandler
oLog.Debug "***** edrmsDetectKnownBarcodes Started *****"
Dim lDocCounter As Long
Dim lFolderCounter As Long
Dim pXFolder As CscXFolder
Dim oXDocInfo As CscXDocInfo
Private Sub Document_BeforeLocate(ByVal pXDoc As CASCADELib.CscXDocument, ByVal LocatorName As String)
Select Case LocatorName
Case "BL_BU_BarcodesKnown"
oLog.Debug "BL_BU_BarcodesKnown Document_BeforeLocate: " & CStr(Now)
If pXDoc.CDoc.Pages.Count > 1 Then
pXDoc.CDoc.Pages.ItemByIndex(1).SuppressOCR = False
End If
End Select
End Sub
Public Sub ClassLevelReRecognitionCheck(ByVal pXDoc As CASCADELib.CscXDocument)
' Compare the class level profile with the project default.
' If different and exists, delete existing representation and re-execute OCR with class level profile.
Dim oPRP As IMpsPageRecogProfile ' requires reference to Kofax Memphis Forms 4.0
Dim oPR As New MpsPageRecognizing
Dim i As Integer
@RNJarvis
RNJarvis / KicBatchPriorityReRoute.cs
Created October 25, 2019 16:18
This is a sample script for KIC to demonstrate the ability to set the Kofax batch priority during import.
//GAC:Microsoft.CSharp.dll,System.IO.dll
using System;
using System.Collections.Generic;
using System.Text;
using Kofax.KCS.ImportConnector.Config;
using Kofax.KCS.ImportConnector.Messages;
using Kofax.KCS.ImportConnector.Scripting;
using System.IO;
using System.Linq;
using Microsoft.Win32;
Private Function GetAdjustedLongCommaDelimitedString(ByVal strList As String, lAdjustBy As Long) As String
Dim arrValues() As String
Dim i As Long
Dim strValue As String
Dim strOutput As String
arrValues = Split(strList, ",")
For i = LBound(arrValues) To UBound(arrValues)
strValue = arrValues(i)
@RNJarvis
RNJarvis / CleanInvalidNameChars.vb
Created September 26, 2019 17:30
Cleans fields containing surname and forenames
'***************************************************************************
'*** Name   : CleanInvalidNameChars
'*** Purpose: Clean up the input to chars that are not alpha, "'", ".", "-",
'***          or " ".  Also removes consecutive spaces.
'*** Inputs : dirtyString
'*** Outputs:
'***
'*** Return : String
'***************************************************************************
Private Function CleanInvalidNameChars(ByVal dirtyString As String) As String
@RNJarvis
RNJarvis / CreateDocumentsFromPagesAndRouteToNewBatchClass.vb
Created September 26, 2019 16:09
This script demonstrates how to take specific pages from within one document and then create new KTM documents with a specific class name. These documents are then routed to a new batch class. All during Batch_Close. Triggering routines: BeginCreate
' ************************************
' *** Cherished Item Routing Start ***
' ************************************
Private Sub BeginCreateCherishedItemDocuments(ByVal pXRootFolder As CASCADELib.CscXFolder, ByVal CloseMode As CASCADELib.CscBatchCloseMode)
On Error GoTo ErrorHandler
OutputDebugString "Scansation.BeginCreateCherishedItemDocuments"
@RNJarvis
RNJarvis / DetectSpecificBarcodesInDoc.vbs
Created September 20, 2019 16:05
KTM Barcode Locator to record page indexes of pages containing specific barcode values.
Private Sub SL_CherishedItemIndicators_LocateAlternatives(ByVal pXDoc As CASCADELib.CscXDocument, ByVal pLocator As CASCADELib.CscXDocField)
On Error GoTo ErrorHandler
OutputDebugString "Scansation.SL_CherishedItemIndicators_LocateAlternatives"
' Barcode Locator alternatives will be checked to search for cherished item indicators
' Where specific item types are found, their page numbers will be saved to a sub field
Dim i As Long
Dim j As Long
Dim oAlt1 As CscXDocFieldAlternative ' Source alternatives to get
'***************************************************************************
'*** Name : GetScriptExecutionName
'*** Purpose: Get the name of the runtime environment
'*** Inputs : lMode (the ID of the runtime environment)
'*** Outputs:
'***
'*** Return : String
'**************************************************************************
Public Function GetScriptExecutionName(lMode As Long) As String