Scripting - Advanced Zone Locator - Creating OMR Zones
Article # 3035590 - Page views: 478
Issue
How to create OMR Zones per Script for the Advanced Zone Locator?
Solution
Use Case
Sometimes forms have many OMR zones and with the Advanced Zone Locator it can be time consuming to add the OMR zones manually.
Keep in mind that an automatic zone wizard was added in 6.3. You can find the Wizard button in the AZL settings on the sheet Zones. Maybe it is sufficient for you.
This article describes how a single KTM project can be used to create OMR zones quickly. Example:
Components
- Format Locator
- Script Locator
- AZL
- OMR Zone Profile
Steps
- Format Locator
This is used to define a region on the document of the CheckBox Group.
- Script Locator
This is used to search for and add the OMR zones in the area defined in the format locator, and group them together.
When testing (i.e., executing the OMR detection and creation) the script locator will ask some questions and display the following dialogues:- Check boxes found: 5 Add them to the AZL?
- Enter the page number on which the OMR group is printed
- Enter the name of the OMR group — in this example 'Block A Q1'
- Results
AZL
- The AZL has to have a sample document defined, before you test the script locator.
- After testing, i.e. executing, the script locator the following zones are added to the AZL:
- Once all OMR groups have been created, then the AZL can be exported and imported to the main project.
Script
- References
'# References:
'# Kofax Cascade Forms Processing 4.0 (4.0)
- CheckBox Detection
- Add the OMR Zone
- Add the OMR Group
Sort Box Information
Private Function SortBoxInfos(ByRef BoxInfos() As CscBoxInfo, ByRef iPixelTolerance As Integer) Dim Sorted As Boolean Dim Condition As Boolean Dim i As Integer Dim Fst As CscBoxInfo Dim Snd As CscBoxInfo Dim Temp As CscBoxInfo Sorted = False Do While Sorted = False Sorted = True For i = 0 To UBound(BoxInfos) - 1 Set Fst = BoxInfos(i) Set Snd = BoxInfos(i + 1) Condition = False If Fst.Top < (Snd.Top - iPixelTolerance) Then Condition = False ElseIf Fst.Top > (Snd.Top + iPixelTolerance) Then Condition = True Else Condition = (Fst.Left > Snd.Left) End If If Condition = True Then Set Temp = BoxInfos(i + 1) Set BoxInfos(i + 1) = BoxInfos(i) Set BoxInfos(i) = Temp Sorted = False End If Next Loop End Function
Function Millimeter to Pixel
Private Function MMToPixel(DocumentResolution As Double, MM As Double) As Double MMToPixel = MM / 25.4 * DocumentResolution End Function
Function Pixel to Millimeter
Private Function PixelToMM(DocumentResolution As Double, Pixel As Double) As Double PixelToMM = (25.4 * Pixel) / DocumentResolution End Function
Level of Complexity
High
Applies to
Product | Version | Build | Environment | Hardware |
---|---|---|---|---|
Kofax Transformation Module | all |
Article # 3035590