This technique is critical to the proper use of VB Scripting for manipulating text for output. Occasionally, how the text is output and the rules for incoming data are in conflict. While a script can be used to "correct" the data, the newly altered data should always be moved to its own output zone. Therefore, a conflict with Rules Parameters does not occur if the verification operator returns to a page they have verified earlier in the batch. Our example will be a social security number - on the form, it will be written as nine handprint characters without dashes (the dashes are preprinted in drop out red). In the output, the social security number must be 11 characters with the dashes in their proper places.
Assumptions that impact how this script is written:
-
The dashes are not OCRed or ICRed from the form.
-
The social security number will have a minimum of 9 and a maximum of 9 characters.
-
All characters in the social security number will be numbers
-
The social security number input is a text zone, the social security number output is an output zone
-
The GUI parameters are needed to get a good ICR read of the data, but will interfere with how the data is output if formatted by a script to the same zone.
-
The handprint zone is "zSSN," and the output zone is "zSSNOutput"
GUI Product Features Used in this Script:
-
Parameters | Rules | Configuration | Characters Per Row Minimum: 9 Maximum: 9
-
Parameters | Rules | Configuration | Output Required - Enabled
-
Recognition Parameters | Print Content | Content | Digits - Enabled
-
Recognition Parameters | Print Type | Handprint | Number of Character Boxes = 9
Key VB Script Features Demonstrated in this Script:
-
Left, Right, and Mid Methods (VB Script)
-
.Value property (OCR for AnyDoc)
-
Use of an Output Zone to hold formatted text.
Example Script:
Dim strTemp, strFirst, strSecond, strThird
strTemp = This.Value
If Len(strTemp) = 9 Then
strFirst = Left(strTemp, 3)
strSecond = Mid(strTemp, 4, 2)
strThird = Right(strTemp, 4)
'push output to output zone
zSSNOutput.Value = strFirst & "-" & strSecond & "-" & strThird
End If