ZPL - how to insert dateTime string in QR code? - datetime

I have ZPL like this, it prints a QR code
^XA
^FO50,100
^BQN,2,5,Q
^FD
Hello world!
Some data
Printed on: dateTimeString
^FS
^XZ
What to put in place of dateTimeString so that the following appears when the QR is scanned
Hello world!
Some data
Printed on: 29-Apr-2022 15:35:54
The printer is Zebra ZD421, if that matters.
Thanks

Assuming the RTC is correctly set on the printer, have you tried to use the date\time wildcard available in ZPL?
Just tested the following code and it did the job
^XA
^FO50,100
^BQN,2,5,Q
^FH\^FC%,{,#
^FDLA,Hello world!\0D\0ASome data %d-%b-%Y %H:%M:%S^FS
^PQ1,0,1,Y
^XZ
check here for additional info

The code would have to be in the scanning device/program, not on the printing device.

Related

Print ZPLII QR to open url

I'm using Zebra ZPLII to create a label with a QR code to open an specific url. When I use iPhone camera to scan the QR phone shows "unusable data" and when I try with an external QR reader the text extracted from the QR is not the same from the label. For example if I write www.google.com the string that I have from reading the QR is .google.com if I use https://www.google.com the result is ps://www.google.com
This is my label desing
^XA
^FX Top section with company logo, name and address.
^CF0,60
^FO220,50^FDIntershipping, Inc.^FS
^CF0,30
^FO220,115^FD1000 Shipping Lane^FS
^FO50,155^GB700,1,3^FS
^FX Third section with barcode.
^BY5,2,70
^FO300,95^BQN,2,4^FDwww.google.com^FS
^XZ
For testing I'm using http://labelary.com/viewer.html
You are missing some of the parameters for the ^BQ and ^FD commands.
^BQ parameters:
^BQa,b,c,d,e
Where
a = Orientation
b = Model
c = Magnification factor
d = Error correction
e = Mask Value
The last two parameters are actually brought into the ^FD command after the ^BQ. Strange design, but that's how it works.
Full Barcode String
^FO300,95^BQN,2,6,M,7^FDQA,www.google.com^FS
Full ZPL for sample label
^XA
^FX Top section with company logo, name and address.
^CF0,60
^FO220,50^FDIntershipping, Inc.^FS
^CF0,30
^FO220,115^FD1000 Shipping Lane^FS
^FO50,155^GB700,1,3^FS
^FX Third section with barcode.
^BY5,2,70
^FO300,95^BQN,2,6,M,7^FDQA,www.google.com^FS
^XZ
Documentation:
https://support.zebra.com/cpws/docs/general/EncodingUnicode_QRCode.pdf
https://support.zebra.com/cpws/docs/zpl/13979l-010_ra.pdf
Find an easy solution, seems that the problem is that all the text after ^FD is not interpreted as text or something like that. To solve my problem I just did this:
^FO300,95^BQN,2,4^FDwww.google.com^FS
change to this:
^FO300,95^BQN,2,4^FD www.google.com^FS

How do I encode Ctrl functions in QR Codes?

I want to make a QR Codes to automate a process for label printing using Easy Labels.
I've already created QR codes that contain file paths and part numbers.
Where I'm running into a brick wall is finding a way to include Control Commands, specifically Ctrl+o and Ctrl+p so Open File and Print commands are issued from the QR code.
I've searched for weeks trying to find a way and this community is the closest thing I've found to a glimmer of hope.
Since I'm trying to do this in plain text, I have no code, so I will provide the desired sequence when scanned by the operator.
(Ctrl+o)T:\Easy Labels\Customers\Toyota\MEX_mat.lab
(Ctrl+p)1704412
The goal is to make a fast and easy way for operators to print their labels as quickly as possible with as few steps as possible on their part with minimum errors.
When the QR is scanned, the first thing it will need to do is issue an Open File command followed by a string that contains the entire file path where the labels for that particular part is located in the database, then sends a return carriage to finish the open process.
Next, it will send a single space to clear a pop-up window message.
Finally, it will send a Print command followed by another string that contains the part number.
If I have to wrote code to accomplish this, assistance would be greatly appreciated.
The test QR code has been generated with Java code. It might or might not be helpful for you:
package qrcodetest;
import io.nayuki.qrcodegen.QrCode;
public class QrCodeWithCtrl {
public static void main(String[] args) {
QrCode qrCode = QrCode.encodeText("\u000fT:\\Easy Labels\\Customers\\Toyota\\MEX_mat.lab\n\u00101704412", QrCode.Ecc.MEDIUM);
System.out.println(qrCode.toSvgString(8));
}
}
In the code \u000f stand for CTRL+O, \u0010 stands for CTRL+P. The four digit number is in hexadecimal and goes from 0001 for CTRL+A to 001a for CTRL+Z.
The code uses the QR code library (available on Maven Central):
io.nayuki:qrcodegen:1.4.0

Printing QR code with a parameter in Zebra language

I'm trying to print a QR code including a parameter on a label
I need to take this value:
^A0R,33,26^FO301,296^FV#01/HarnessId;02/02;03/
HarnessId (z.B. 999):;04/-;05/param_HarnessIdCnt#^FS
and put it in a QR code. I tried this, but i doesn't print anything:
^BXN,10,20,,,,,2^FO153,43^FV#01/HarnessId;02/02;03/
HarnessId (z.B. 999):;04/-;05/param_HarnessIdCnt#^FS
you should try with the BQ command
Link to viewer

ZPL QR code not printing what is in the string

I've got the following ZPL code which prints a QR code with fielddata X50X-8091X-11111.
^XA^PON^FWN^FO30,10^BQN,2,6^FDx50x-8091x-12345^FS^XZ
But what the scanner scans from the QR code is this: 0X8091X11111. So the first X50 is not printed.
What can I do?
The ZPL manual has a very detailed explanation of the data switches for QR codes: ^BQ Command
Edit: Sorry #Veve, the explination is VERY long. Here is the simplified explination:
The chars immediately following ^FD are switches (as defined here)
So you can use something like this;
^XA^FO100,100^BQN,2,4^FD x50x-8091x-12345^FS^XZ
or this;
^XA^FO100,100^BQN,2,4^FDHM,A x50x-8091x-12345^FS^XZ

run monkey_recorder.py error: mismatched input 'monkey_recorder' expecting NEWLINE

When I tried to use monkeyrunner command to run recorder, I got the error: mismatched input 'monkey_recorder' expecting NEWLINE.
Here is screenshot of my command.
enter image description here
You should try AndroidViewClient/culebra which will give you some advantages over monkeyrunner and monkey_recorder. For example, instead of recording the screen coordinates for a touch, culebra records the selector of the View touched so the script or test will be screen coordinates agnostic.
See Culebra GUI page for details.

Resources