Using VBScript with Printer Code Modifiers |
If you want to modify print code beyond the simple search and replace functions in the Search and Replace (Printer Code Modifier) dialog, you can create custom Visual Basic Script (VBScript) to modify print code output before it is sent to the printer or printer code template. By using VBScript, you can have complete control over the print code output.
'The variable that is found defines whether the portion
'of code has already been modified
'Initially, the code has not been modified and is set to False
found = False
'Read each line of print code in the object PCM
Do Until PCM.FileAtEOF
'Define a variable that holds the line of print code that is being read
variableLine = PCM.ReadLine()
'Check to determine whether the line of code needs to be modified
If variableLine = "My criteria" Then
'Check to verify that the line has not already been modified
If found = False Then
'Modify the contents of the line
PCM.WriteLine("My New Value")
'Set found to True
found = True
Else
'If none of the previous are true,
'rewrite the unmodified line to PCM
PCM.WriteLine(variableLine)
End If
End If
Loop
Related Topics