Skip to main content

Advanced Zone Locator — Creating OMR Zones per Script

Article # 304814 - Page views: 987


QAID # 17759 Published

Question / Problem:

Advanced Zone Locator — Creating OMR Zones per Script

Answer / 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.

This article describes how a single KTM project can be used to create OMR zones quickly. Example:

Screen Shot 2018-09-12 at 7.14.25 AM.png


  • Format Locator
    Screen Shot 2018-09-12 at 7.14.52 AM.png
  • Script Locator
    Screen Shot 2018-09-12 at 7.14.59 AM.png
  • AZL
    Screen Shot 2018-09-12 at 7.15.06 AM.png
  • OMR Zone Profile
    Screen Shot 2018-09-12 at 7.16.51 AM.png


  • Format Locator
    This is used to define a region on the document of the CheckBox Group.
    Screen Shot 2018-09-12 at 7.18.05 AM.png
  • 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
      Screen Shot 2018-09-12 at 7.20.32 AM.png
      Screen Shot 2018-09-12 at 7.20.51 AM.png
      Screen Shot 2018-09-12 at 7.21.12 AM.png


  • 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:
    Screen Shot 2018-09-12 at 7.21.56 AM.png
  • Once all OMR groups have been created, then the AZL can be exported and imported to the main project. Screen Shot 2018-09-12 at 7.22.23 AM.png



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
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
End Function
  • Millimetre to Pixel
Private Function MMToPixel(DocumentResolution As Double, MM As Double) As Double
MMToPixel = MM / 25.4 * DocumentResolution
End Function
  • Pixel to Millimetre
Private Function PixelToMM(DocumentResolution As Double, Pixel As Double) As Double
PixelToMM = (25.4 * Pixel) / DocumentResolution
End Function

Applies to:

Product Version
  • Was this article helpful?