Shortcuts and Alternate Schemes for Writing ZPL II Scripts
Shortcuts and Alternate Schemes for Writing ZPL II Scripts

Shortcuts and Alternate Schemes for Writing ZPL II Scripts

ZPL II programming scripts can be written in a variety of ways. There are, however, more efficient ways to write a ZPL II script depending on the application and the commands used. The following are certain ways to write the same ZPL II script, each yielding the same result.
The Code 39 bar code shows the ZPL II script written like this:
^XA^FO100,75^BY3 ^B3N,N,100,Y,N ^FD123ABC^XZ
Since it is only one field, however, the entire command can be written as a one line entry:
^XA^FO100,75^BY3^B3N,N,100,Y,N^FD123ABC^XZ
Finally, this script can be further simplified by writing it on one line, using the comma (,) delimiter to reduce the default parameters in the
^B3
command and eliminating the default parameters at the end of the
^B3
command:
^XA^FO100,75^BY3^B3,,100^FD123ABC^XZ
You might write your ZPL II scripts in any way that makes sense to you. Some programmers prefer to write out each format command and field on a line by line basis like this:
^XA ^PR2^FS ^LL935^FS ^LH30,30^FS ^FO20,10^AF^FDZEBRA^FS ^FO20,60^B3,,40^FDAA001^FS ^FO20,180^AF^SNSERIAL NUMBER 00000000111,1,Y^FS ^PQ10^FS ^XZ
Although this script will print with no problems, it contains unnecessary
^FS
(Field Separator) commands which have been placed after the format commands. Some programmers feel it is required to place a
^FS
command at the end of each line, but the
^FS
command is only needed to separate specific fields. Therefore, the script would transmit more quickly written like this:
^XA ^PR2 ^LL935 ^LH30,30 ^FO20,10^AF^FDZEBRA^FS ^FO20,60^B3,,40^FDAA001^FS ^FO20,180^AF^SNSERIAL NUMBER 00000000111,1,Y^FS ^PQ10 ^XZ
Other programmers prefer to keep the format commands on one line as an organizational preference, like this:
^XA^PR2^LL935^LH30,30 ^FO20,10^AF^FDZEBRA^FS ^FO20,60^B3,,40^FDAA001^FS ^FO20,180^AF^SNSERIAL NUMBER 00000000111,1,Y^FS ^PQ10^XZ
The label will print out the same so you should develop a scripting pattern that suits your own organizational style but one which is efficient and is concerned with keeping transmission times to a minimum.