Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to manually define a variable in Zebra Programming Language? (ZPL)

I'm programming in ZPL and I need to define a variable manually. A simple Hello World Example:

^XA
^FO,20,10^ADN,40,25^FDHello World^FS
^XZ

I want to be able to:

SET $HW$ = Hello World
^XA
^FO,20,10^ADN,40,25^FD$HW$^FS
^XZ

I read the Zebra documentation and it talks only about its use in ZebraDesigner Pro, but I must define it with code, not with graphical mode. And the variables like $CODEDATA$, SVERSION$ are not working automatically here. Then, how can I define a variable in ZPL?

like image 878
Marcelo Camargo Avatar asked May 17 '26 00:05

Marcelo Camargo


1 Answers

Here is a way to do what you are looking for. Store a format with a variable. ^FN11 is the variable in the stored format. I'm storing the format on the internal flash (E:) I've named the stored format STORE.ZPL

^XA
^DFE:STORE.ZPL^FS
^FO,20,10^ADN,40,25^FH\^FN11^^FS
^XZ

I then recall the format and set the variable

^XA
^XFE:STORE.ZPL^FS
^FN11Hello World^FS
^XZ
like image 129
Elton Saunders Avatar answered May 19 '26 13:05

Elton Saunders



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!