Skip to main content

Examples

The examples use a printer with the ID NoLabel, and the Text Line protocol on port 11000.

Selecting a label with a barcode scanner​

Goal: the operator scans a code, and the label with that name is printed.

  1. Configure the scanner to connect to the printer on port 11000, and to send CR, LF or CR+LF after each code. Before v6.0.1, CR alone does not work.

  2. Add the Text Line protocol on port 11000.

  3. Set Trim whitespace to on, in case the scanner adds spaces.

  4. Set Error Value to the text the scanner sends when it fails to read a code, if any.

  5. Add an action:

    FieldValue
    TypeSelect label
    PrintersNoLabel

Scanning Carton selects the label Carton. Scanning a code that is not a label name logs an error and leaves the current job selected.

If the codes are numbers and the labels are named P1, P2 and so on, set Prefix to P.

Selecting a product from a table​

Goal: the scanned code is an article number, and a table says which label to print, and how many copies.

With this table, named Products:

ArticleLabelCopies
A100Carton1
A200Pallet2

Add an action:

FieldValue
TypeSelect from table
PrintersNoLabel
Table nameProducts
Key columnArticle
Label columnLabel
Copies columnCopies
LineResult
A200Selects 2 copies of the label Pallet.
X999No such key. An error is logged, and nothing is selected.

Using part of the scanned code​

Goal: the scanner reads a code such as ART:A200;LOT:4711, but only the article number is the table key.

Use the action from the previous example, with Pattern set to ART:([^;]+). The first group, A200, is used as the key. A line that does not contain ART: is skipped by the action, and an error is logged.

Printing on two printers​

Goal: one scanned code selects the same label on two printers.

Add two Select label actions, one for each printer. Both actions run for every line.

Sending lines from a script​

Any program that can open a TCP connection can use the protocol. End every line with LF, including the last one.

From a shell, with netcat:

printf 'Carton\n' | nc -q 1 printer.local 11000

From Python:

import socket

with socket.create_connection(("printer.local", 11000)) as s:
s.sendall(b"A200\n")

The printer sends no reply, so the client cannot tell from the connection whether a job was selected. To check, read the selected job with getCurrentPrintJob, or look in the printer's log.