Skip to content

Instantly share code, notes, and snippets.

Private Sub SetupDynamicMETFormatLocator(ByVal pXDoc As CASCADELib.CscXDocument, ByVal sLocatorName As String)
On Error GoTo ErrorHandler
oLog.Debug "SetupDynamicMETFormatLocator Starting"
Dim i As Long
Dim sRuleKtmClassName As String
Dim sRuleKtmFieldName As String
Dim locft As CscRegExpLib.CscRegExpLocator
Dim Loc As CscLocatorDef
Public Function GetDictionaryReplaceVal(sQueryValue As String, sDictName As String) As String
GetDictionaryReplaceVal = "Unknown"
Dim dict As CscDictionary
Dim resItems As CscDictionaryResItems
Dim strData1 As String
Dim strReplaceVal As String
'** Get Dictionary object from Project
Set dict = Project.Dictionaries.ItemByName(sDictName)
Private Sub KtmClassRemoval()
oLog.Debug "KtmClassRemoval..."
oLog.Debug "KtmProjectClassCountStart: " & CStr(Project.ClassCount)
Dim oClassData As CscXDocField
Dim i As Long
Dim strKtmClassNameDB As String
Dim strKtmClassNameKT As String
Private Sub LogProjectClassNames()
Dim i As Long
Dim sFilePath As String
Dim FSO As Object
Dim iFreeFile As Integer
Set FSO = CreateObject("Scripting.FileSystemObject")
sFilePath = FSO.BuildPath("E:\Temp", "ClassNames.txt")
@RNJarvis
RNJarvis / LogKtmClassProperties.vb
Created April 2, 2020 16:46
Loop Ktm Classes Look for specific properties and log
Private Sub ReportClasses()
Dim i As Long
Dim oClass As CscClass
Dim oLocatorDef As CscLocatorDef
'Dim locft As CscRegExpLib.CscRegExpLocator
Dim oLocMeth As ICscExtractionMethod
'Dim oAZL As CscAdvZoneLocator '# Reference this object - "LCI Cascade Advanced Zone Locator 2.0"
@RNJarvis
RNJarvis / DocumentClassRouting.vb
Created April 1, 2020 09:40
KTM ChangeClass method used from Batch CLose
Public Sub DocumentClassRouting(ByVal pXRootFolder As CASCADELib.CscXFolder)
On Error GoTo ErrorHandler
LogMessage "Scansation.DocumentClassRouting"
' Check document conditions & perform any final re-classifications
Dim i, j, k As Long
Dim oXDocInfo As CscXDocInfo
Dim oXValue As CscXValue
Dim oResults As CscXDocField
Private Function StripNonNumericsNoException(ByVal sInputStr As String) As String
Dim iLength As Integer
iLength = Len(sInputStr)
While iLength > 0
If IsNumeric(Left(Right(sInputStr, iLength), 1)) = False Then
sInputStr = Replace(sInputStr, Left(Right(sInputStr, iLength), 1), "")
End If
iLength = iLength - 1
Private Sub Setup_FL_ToggleRegexByDescriptionMatch(ByVal pXDoc As CASCADELib.CscXDocument, ByVal sClassName As String, ByVal sRegexDescription As String, ByVal sLocatorName As String)
Dim i As Long
Dim locft As CscRegExpLib.CscRegExpLocator
Dim Loc As CscLocatorDef
Set Loc = Project.ClassByName(sClassName).Locators.ItemByName(sLocatorName)
Set locft = Loc.LocatorMethod
@RNJarvis
RNJarvis / CopyBatchImages.vb
Created March 5, 2020 16:07
Call this from Batch Open or from a Validation Form Button Required a project script variable (BackupTiffsPath) to specify the root output path
Public Sub BeginBackupTiffs(ByVal pXRootFolder As CASCADELib.CscXFolder)
On Error GoTo ErrorHandler
LogMessage "Scansation.***** BeginBackupTiffs Started *****"
Dim strDirPath As String
Dim strFolderName As String
LogMessage "Scansation.Starting BeginBackupTiffs..."
strDirPath = CStr(Project.ScriptVariables.ItemByName("BackupTiffsPath").Value) & "\" & Format(Now, "yyyymmdd hhnnss") & "\"
LogMessage "Scansation.Root dir path: " & strDirPath
@RNJarvis
RNJarvis / DetectBarcodes2.vb
Last active February 7, 2020 16:47
Detect Barcodes in KTM using .Locate method at Batch_Close
Public Sub edrmsDetectKnownBarcodes(ByVal pXRootFolder As CASCADELib.CscXFolder)
On Error GoTo ErrorHandler
oLog.Error "***** edrmsDetectKnownBarcodes Started *****" & CStr(Now)
Dim lDocCounter As Long
Dim lFolderCounter As Long
Dim pXFolder As CscXFolder
Dim oXDocInfo As CscXDocInfo
Select Case pXRootFolder.Fields.ItemByName("MET12_BusinessUnitID").Text