Vb Script : In A Batch Print, Identify The Break Between Two Article References And Print A Marker On The First Label
Dear
I have an issue to setup a conditional print between labels printing.
I have N labels related to different articles. Because the qty can be high, I would like to put on the first label (related to the same article) a marker to identify where the article code changes.
In the sample below, I would like to print somewhere on the label a character to identity the first label (****)
Label 1: Article A ****
Label 2: Article A
Label 3: Article A
Label 4: Article B ****
Label 5: Article B
......
thanks for your support.
-
Gene Henson
★ BarTender Hero ★
I've attached two files here. Just put them in the same directory on your hard drive.
- Fruit.btw is a BarTender document that has some sample VB scripts to accomplish this.
- Fruit.txt is a sample database to be used with the file.
There are three objects on the label format:
- Just above the printable region is an object whose sole purpose is to hold the value of the previously printed record from the database.
- The topmost object in the printable region of the label is the value from the database that is we're currently printing.
- The bottom object on the label has a script that shows "New Record" whenever #1 changes
There are two places I've written VBScript in object #3.
OnPrintStart:'Called at the start of a print job.
'This sets the value of the ValueHolder to bogus data when the print job starts.
'This ensures the first label shows New Record
Format.NamedSubStrings("ValueHolder").Value = "bogus data"
OnNewRecord:dim temp
dim temp2
'Set temp2 to the current database valuetemp2 = Field("Fruit.Field 1")
'Compare temp2 to the value of "ValueHolder". If it's a new record, set temp to New Record
If temp2 = Format.NamedSubStrings("ValueHolder").Value Then
temp = ""
Else
temp = "New Record"
End If
'Set ValueHolder equal to the just printed database field
Format.NamedSubStrings("ValueHolder").Value = Field("Fruit.Field 1")
Value = temp
0
Bitte melden Sie sich an, um einen Kommentar zu hinterlassen.
Kommentare
1 Kommentar