Website | English | ไธญๆ–‡

16Trigger Tool Usage

An automatic printing tool independent of the Designer: it listens for events (File / Timer / Serial Port / Manual / Network HTTP / Database) โ†’ checks the condition โ†’ loads a .iba template and prints.

16.1 Basic Concepts

A trigger = Trigger Source (when to wake) + Trigger Condition (whether to pass) + Action (what to do)

ConceptDescription
Trigger SourceWhen to trigger: File Monitoring, Timer, Serial Port data, Manual, Network HTTP, Database polling
Trigger ConditionOptional expression; the action runs only when it evaluates to true; leave empty = always run
ActionPrint a specified .iba template (with data injection, selectable printer / copies)

16.2 Interface Layout

16.3 File Monitoring (most common)

  1. Click "๏ผ‹ Add Trigger", select type File Monitoring
  2. Folder: enter or browse the folder to watch, e.g. D:\Triggers
  3. Filter: *.txt watches only txt; *.csv only csv; *.* everything
  4. Trigger Action: choose the .iba template, printer, print mode (GDI / ZPL), copies
  5. Delete trigger file after successful print (optional): deletes the source file after a successful print to avoid repeated triggers / file accumulation; failed prints keep the file for retry
  6. Click โ–ถ Start
  7. Drop a matching file into the folder โ†’ auto print

About repeated triggers: dropping a file can raise multiple events (create + several changes). The tool has built-in deduplication (the same file triggers only once within 2 seconds), so one file prints once. If the writing program takes more than 2 seconds, it may trigger again; enable "Delete trigger file" to avoid this further.

16.4 Timer

  1. Select type Timer
  2. Interval (ms): e.g. 5000 = every 5 seconds; 60000 = every minute
  3. Configure the template / printer, start, and it prints automatically each interval

16.5 Manual

  1. Select type Manual
  2. Configure the template / printer, then click "Test Trigger" to run once immediately (also used for external ManualTrigger(Id) calls)

16.6 Serial Port

  1. Select type Serial Port
  2. Port: automatically lists all serial ports (refreshable); Baud rate: e.g. 9600
  3. Each line of data received triggers once; data fields are described under "Trigger Condition Variables" below

16.7 Network HTTP Trigger

  1. Select type Network HTTP
  2. Port (default 8700), Path (default trigger)
  3. The config area automatically shows the callable URL (localhost loopback + LAN IP) with a sample query
  4. Accessing http://IP:port/path from the other system triggers printing; three content formats are supported, multiple fields become data fields automatically:
    • GET query parameters: http://IP:8700/trigger?batch=LOT1&qty=500
    • POST form: Content-Type: application/x-www-form-urlencoded, body batch=LOT1&qty=500
    • POST JSON: Content-Type: application/json, body {"batch":"LOT1","qty":500,"detail":{"customer":"ACME"}}
      • Nested objects are flattened with dot notation: detail.customer = ACME; arrays keep the raw JSON text (field JsonArray)
    • Built-in fields: EventType=Network, Url, Body (raw body)
  5. Token (optional): if set, the caller must provide it, otherwise 401 is returned and nothing triggers
    • Any one of: ?token=value parameter / X-Api-Token: value header / Authorization: Bearer value
  6. Data fields = request parameter names; map them with custom field names to template variables

16.8 Network HTTP Trigger โ€” Testing (POSTMAN / Winsock Debugger)

Response codes: 200 OK = received and triggered; 401 = wrong Token; 404 = path does not match the configuration.

Method 1: POSTMAN (recommended, format handled automatically)

  1. GET: method GET, URL http://127.0.0.1:8700/trigger, add order=abc, batch=123 under Params, click Send
  2. POST form: method POST, Body โ†’ x-www-form-urlencoded, enter order=abc, batch=123, Send
  3. POST JSON: Body โ†’ raw โ†’ type JSON, content like {"order":"abc","batch":123}, Send
  4. Token: for GET add token=value in Params; or add header X-Api-Token: value
  5. Use the port / path shown in the tool UI (not necessarily 8700)

Method 2: Winsock / Network Debugger (raw TCP)

The debugger is a "raw TCP" tool that only sends bytes โ€” you must write the HTTP format yourself:

GET /trigger?order=abc&batch=123 HTTP/1.1
Host: 127.0.0.1:8700
Connection: close

16.9 Database Trigger (SQLite / MySQL / PostgreSQL / SQL Server / Oracle)

  1. Select type Database, choose the database type:
    • SQLite โ†’ pick the database file (.db / .sqlite / .db3)
    • MySQL / PostgreSQL / SQL Server / Oracle โ†’ enter server, port, database, username, password
      • Default ports: MySQL 3306, PostgreSQL 5432, SQL Server 1433 (can be left blank), Oracle 1521
  2. Click Test Connection to verify the connection settings
  3. Query SQL: a SELECT returning rows to process, e.g. SELECT * FROM print_queue
  4. Polling interval (ms): default 5000
  5. Process SQL (optional): runs after each row triggers, {column} references the row value, e.g. DELETE FROM print_queue WHERE id={id}
  6. Each row triggers once; the row's columns become data fields (column name โ†’ map with custom field name)

16.10 Trigger Conditions (important)

Leave empty = every trigger event runs directly. Fill it in = runs only when the expression is true.

Available variables

VariableTrigger sourceMeaningExample
FileNameFileFile name (no path)ok.txt
FilePathFileFull pathD:\Triggers\ok.txt
EventTypeFileEvent typeCreated(new) Changed(modified)
TriggerTimeTimerTrigger time2026-08-03 12:00:00
DataSerial PortOne line of received dataM6x20
PortNameSerial PortPort nameCOM1
SourceManualTrigger sourceUI test

Syntax

Common examples

FileName == "ok.txt"                         // only ok.txt
FileName.EndsWith("_print.csv")              // ends with _print.csv
EventType == "Created"                       // trigger only on create (ignore modify)
FileName.Contains("urgent") && EventType == "Created"
!FileName.StartsWith("temp")                 // exclude temp prefix
Data == "DONE"                               // serial port receives DONE

16.11 Data Mapping (injecting template variables)

Fill trigger data into template variables so label content changes with the data.

  1. Delimiter: enter a custom delimiter to split the file content into segments
    • Common: comma ,, slash /, semicolon ;, tab \t, CRLF \r\n
    • Multiple delimiters separated by |, e.g. ,|\r\n = comma or CRLF
    • Leave empty = whole file = 1 value
    • Preset buttons: comma / slash / semicolon / Tab / newline / comma-or-newline
  2. Trigger data field dropdown:
    • Field 1 / Field 2 โ€ฆ โ†’ with a file = segment 1 / 2 / โ€ฆ; for Network / Database triggers = the 1st / 2nd / โ€ฆ received field (in arrival order)
    • FileContent โ†’ whole file text
    • FilePath / FileName / EventType / TriggerTime โ†’ event data
    • Data โ†’ serial port data
    • Network / Database multi-fields can also be mapped directly by custom field name (more intuitive)
  3. Template variable: enter the variable name (no braces), e.g. template uses {Batch} โ†’ enter Batch
  4. Click "๏ผ‹ Add Mapping"
  5. On trigger, {variable} in the template is replaced by the corresponding data

Single-field example

File content: LOT20260803; map FileContent โ†’ batch; template {batch} = LOT20260803

Multi-field example (CSV)

File content: LOT20260803,500,PO-2026-001

Field 1 โ†’ batch
Field 2 โ†’ qty
Field 3 โ†’ orderNo

Multi-field example (one value per line)

File content:

LOT20260803
500
PO-2026-001

16.12 Configuration Persistence

16.13 Print Modes

ModeApplies toConfiguration needed
Driver printWindows driver printers (regular laser / inkjet), consistent across printersPrinter name
ZPL printZebra-compatible barcode printers, raw ZPL via Windows driverPrinter name (driver installed)
Driverless ZPLBypasses the driver, sends ZPL straight over TCP (Zebra default 9100)Printer IP + port (default 9100)

16.14 Quick Test Guide

  1. Create a simple template (with a variable such as {FileName})
  2. Add a File Monitoring trigger pointing to an empty folder, filter *.txt
  3. Click "Start"
  4. Create ok.txt with Notepad and drop it into the folder
  5. Check the bottom log: should show "triggered โ†’ load template โ†’ inject variables โ†’ print done"
  6. To avoid real printing, leave the printer unset and watch the log for triggering and template loading
SDK Integration Contents Trigger Tool โ€บ