將 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
相關主題