将 VBScript 与打印机代码修改器一起使用 |
如果要在“搜索和替换(打印机代码修改器)”对话框中修改除简单的“搜索并替换”功能之外的打印代码,在将打印代码发送到打印机或打印机代码模板之前,可以创建自定义 Visual Basic 脚本 (VBScript) 来修改打印代码输出。使用 VBScript 可以完全控制打印代码输出。
'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 being read
variableLine = PCM.ReadLine()
'Check to see if the line of code needs to be modified
If variableLine = "My criteria" Then
'Check to see 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
相关主题