Official translation unavailable. Translate this page with Google:

Command Files Specifications

Command files contain instructions for the print process. These instructions are expressed with NiceLabel commands. Commands are executed one at a time from beginning to the end of the file. The files support Unicode formatting, so you can include multi-lingual contents. Command files come in three different flavors.

CSV Command File

The commands available in CSV command files are a subset of NiceLabel commands. The following commands are available: LABEL, SET, PORT, PRINTER and PRINT.

CSV stands for Comma Separated Values. CSV file is a text file in which values are delimited by comma (,) character. Such text file can contain Unicode value (important for multi-language data). Each line in the CSV command file contains commands for a single label print action.

The first row in a CSV command file must contain commands and variable names. The order of commands and names is not important, but all records in the same data stream must follow the same structure. Variable name-value pairs are extracted automatically and sent to the referenced label. If the variable with the name from CSV does not exist on the label, no error message is displayed.

Sample CSV Command File

The sample presents the structural view on the fields that you can use in the CSV command file.

@Label,@Printer,@Quantity,@Skip,@IdenticalCopies,NumberOfSets,@Port,Product_ID, Product_Name
label1.nlbl, CAB A3 203 DPI, 100, , , , , 100A, Product 1
label2.nlbl, Zebra R-402, 20, , , , , 200A, Product 2

CSV Commands Specification

The commands in the first line of data must be expressed with at (@) character. The fields without @ at the beginning are names of variables. These fields are extracted with their values as name-value pairs.

  • @Label: Specifies the label name to be used. It's a good practice to include label path and filename. Make sure the service user can access the file. For more information, see section Access to Network Shared Resources in NiceLabel Automation user guide. A required field.

  • @Printer: Specifies the printer to be used. It overrides the printer defined in the label. Make sure the service user can access the printer. For more information, see section Access to Network Shared Resources. Optional field.

  • @Quantity: Specifies the number of labels to be printed. Possible values: numeric value, VARIABLE or UNLIMITED. For more information, see section Print Label. A required field.

  • @Skip: Specifies the number of labels to be skipped at the beginning of the first printed page. This feature is useful if you want to re-use the partially printed sheet of labels. Optional field.

  • @IdenticalCopies: Specifies the number of label copies that should be printed for each unique label. This feature is useful when printing labels with data from database or when you use counters, and you need label copies. Optional field.

  • @NumberOfSets: Specifies the number of times the printing process should repeat. Each label set equals a single occurrence of printing process. Optional field.

  • @Port: Specifies the port name for the printer. You can override the default port as specified in the printer driver. You can also use it to redirect printing to file. Optional field.

  • Other field names: All other fields define names of variables from the label. The field contents are saved to the variable of the same name as its value.

JOB Command File

JOB command file is a text file that contains NiceLabel commands. The commands execute in top-to-bottom order. The commands usually start with LABEL (to open label), then SET (to set variable value) and finally PRINT (to print label). For more information about the available commands, see section Using Custom Commands.

Sample JOB Command File

This JOB file open label2.nlbl, sets variable values and prints a single label. Because no PRINTER command is used to redirect printing, the gets printed using the printer name as defined in the label.

LABEL "label2.nlbl"
SET code="12345"
SET article="FUSILLI"
SET ean="383860026501"
SET weight="1,0 kg"
PRINT 1

XML Command File

The commands available in the XML Command files are a subset of NiceLabel commands. The following commands are available: LOGIN, LABEL, SET, PORT, PRINTER, SESSIONEND, SESSIONSTART and SESSIONPRINT. The syntax for these commands differs to some extent if they are used in an XML file.

Root element in the XML Command file is <Nice_Commands>. The next element that must follow is <Label>. This element specifies the label to be used.

To start printing the labels , there are two available methods: print labels normally using the element <Print_Job>, or print labels in a session using the element <Session_Print_Job>. You can also change the printer to which the labels are printed, and additionally set the variable value.

Sample XML Command File

The sample below serves as a structural overview of the elements and their attributes as you can use them in an XML command file.

<nice_commands>
    <label name="label1.nlbl">

        <session_print_job printer="CAB A3 203DPI" skip=0 job_name="job name 1" print_to_file="filename 1">
            <session quantity="10">
                <variable name="variable name 1" >variable value 1</variable>
            </session>
        </session_print_job>

        <print_job printer="Zebra R-402" quantity="10" skip=0 identical_copies=1 number_of_sets=1 job_name="job name 2" print_to_file="filename 2">
            <variable name="variable1" >1</variable>
            <variable name="variable2" >2</variable> 
            <variable name="variable3" >3</variable>
        </print_job>
    </label>
</nice_commands>

XML Command File Specification

This section contains description of the XML Command file structure. There are several elements that contain attributes. Some attributes are required while the others are optional. Some attributes can occupy pre-defined values only, while for the others, you can specify custom values.

  • <Nice_Commands>: This is a root element.

  • <Label>: Specifies the label file to be opened. If the label is already opened, it does not re-open. The label file must be accessible from this computer. For more information, see section Access to Network Shared Resources. This element can occur several times within the command file.

    • Name: This attribute contains label name. You can include the path along with the label name. Required.

  • <Print_Job>: The element that contains data for a single label job. This element can occur several times within the command file.

    • Printer:: Use this attribute to override the printer defined in the label. The printer must be accessible from this computer. For more information, see section Access to Network Shared Resources. Optional.

    • Quantity: Use this attribute to specify the number of labels to be printed. Possible values: numeric value, VARIABLE or UNLIMITED. For more information on parameters, see section Print Label. Required.

    • Skip: Use this attribute to specify how many labels should be skipped at the beginning. This feature is useful if you print a sheet of labels to laser printer, but the sheet is partial already printed. For more information, see the see section Print Label. Optional.

    • Job_name: Use this attribute to specify the name of your job file. The specified name is visible in the print spooler. For more information, see section Set print job name. Optional.

    • Print_to_file: Use this attribute to specify the file name to which you want to save the printer commands. For more information, see section Redirect Printing to File. Optional.

    • Identical_copies: Use this attribute to specify the number of copies you need for each label. For more information, see section Print Label. Op

  • <Session_Print_Job>: The element that contains commands and data for one or more sessions. The element can contain one or more <Session> elements. It considers session print rules. You can use this element several times within the command file. For available attributes, look up the attributes for the <Print_Job> element. All of them are valid, you just cannot use the quantity attribute. See the description of <Session> element to find out how to specify label quantity in session printing.

  • <Session>: The element that contains data for one session. When printing in session, all labels are encoded into a single print job and sent to the printer.

    • Quantity: Use this attribute to specify the number of printed labels. Possible values: numeric value, string VARIABLE, or string UNLIMITED. For more information on parameters, see section Print Label. Required.

  • <Variable>: The element that sets the variable values on the label. This element can occur several times within the command file.

    • Name: The attribute contains the variable name. Required.

XML Schema Definition (XSD) for XML Command File

<?xml version="1.0" encoding="utf-8"?>
<xs:schema targetNamespace="http://tempuri.org/XMLSchema.xsd" elementFormDefault="qualified" xmlns="http://tempuri.org/XMLSchema.xsd" xmlns:mstns="http://tempuri.org/XMLSchema.xsd" xmlns:xs="http://www.w3.org/2001/XMLSchema">
    <xs:element name="nice_commands">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="label" maxOccurs="unbounded" minOccurs="1">
                    <xs:complexType>
                        <xs:sequence>
                            <xs:element name="print_job" maxOccurs="unbounded" minOccurs="0">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="database" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="table" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="variable" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">   
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="quantity" type="xs:string" use="required" />
                                    <xs:attribute name="printer" type="xs:string" use="optional" />
                                    <xs:attribute name="skip" type="xs:integer" use="optional" />
                                    <xs:attribute name="identical_copies" type="xs:integer" use="optional" />
                                    <xs:attribute name="number_of_sets" type="xs:integer" use="optional" />
                                    <xs:attribute name="job_name" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file_append" type="xs:boolean" use="optional" />
                                    <xs:attribute name="clear_variable_values" type="xs:boolean" use="optional" />
                                </xs:complexType>
                            </xs:element>
                            <xs:element name="session_print_job" maxOccurs="unbounded" minOccurs="0">
                                <xs:complexType>
                                    <xs:sequence>
                                        <xs:element name="database" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">       
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="table" maxOccurs="unbounded" minOccurs="0">
                                            <xs:complexType>
                                                <xs:simpleContent>
                                                    <xs:extension base="xs:string">
                                                        <xs:attribute name="name" type="xs:string" use="required" />
                                                    </xs:extension>
                                                </xs:simpleContent>
                                            </xs:complexType>
                                        </xs:element>
                                        <xs:element name="session" minOccurs="1" maxOccurs="unbounded">
                                            <xs:complexType>
                                                <xs:sequence>
                                                    <xs:element name="variable" minOccurs="0" maxOccurs="unbounded">
                                                        <xs:complexType>    
                                                            <xs:simpleContent>
                                                                <xs:extension base="xs:string">
                                                                    <xs:attribute name="name" type="xs:string" use="required" />                                                                
                                                                </xs:extension>       
                                                            </xs:simpleContent>
                                                        </xs:complexType>
                                                    </xs:element>
                                                </xs:sequence>
                                                <xs:attribute name="quantity" type="xs:string" use="required" />
                                            </xs:complexType>
                                        </xs:element>
                                    </xs:sequence>
                                    <xs:attribute name="printer" type="xs:string" use="optional" />
                                    <xs:attribute name="skip" type="xs:integer" use="optional" />
                                    <xs:attribute name="job_name" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file" type="xs:string" use="optional" />
                                    <xs:attribute name="print_to_file_append" type="xs:boolean" use="optional" />
                                    <xs:attribute name="clear_variable_values" type="xs:boolean" use="optional" />
                                </xs:complexType>
                            </xs:element>
                        </xs:sequence>
                        <xs:attribute name="name" type="xs:string" use="required" />
                        <xs:attribute name="close" type="xs:boolean" use="optional" />
                        <xs:attribute name="clear_variable_values" type="xs:boolean" use="optional" />
                    </xs:complexType>
                </xs:element>
            </xs:sequence>
            <xs:attribute name="quit" type="xs:boolean" use="required" />
        </xs:complexType>
    </xs:element>
</xs:schema>

Oracle XML Specifications

Oracle defines the XML format so that the XML contents can be understood, parsed and printed on labels. The XML Document Type Definition (DTD) defines the XML tags that are used in an XML file. Oracle generates XML files according to this DTD, and any 3rd party software translates XML files according to this DTD.

To execute an Oracle XML command file, use the Run Oracle XML Command File action.

XML DTD

The following is the XML DTD that is used while forming an XML for both – synchronous and asynchronous XML formats. The DTD defines elements that are used in the XML file, list of their attributes, and next level elements.

<!ELEMENT labels (label)*>
<!ATTLIST labels _FORMAT CDATA #IMPLIED>
<!ATTLIST labels _JOBNAME CDATA #IMPLIED>
<!ATTLIST labels _QUANTITY CDATA #IMPLIED>
<!ATTLIST labels _PRINTERNAME CDATA #IMPLIED>
<!ELEMENT label (variable)*>
<!ATTLIST label _FORMAT CDATA #IMPLIED>
<!ATTLIST label _JOBNAME CDATA #IMPLIED>
<!ATTLIST label _QUANTITY CDATA #IMPLIED>

Sample Oracle XML

This is the Oracle XML providing data for one label (there is only one <label> element).

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE labels SYSTEM "label.dtd">
<labels _FORMAT ="Serial.nlbl" _QUANTITY="1" _PRINTERNAME="" _JOBNAME="Serial">
    <label>
        <variable name= "item">O Ring</variable>
        <variable name= "revision">V1</variable>
        <variable name= "lot">123</variable>
        <variable name= "serial_number">12345</variable>
        <variable name= "lot_status">123</variable>
        <variable name= "serial_number_status">Active</variable>
        <variable name= "organization">A1</variable>
    </label>
</labels>

When executing this sample Oracle XML file, the label serial.nlbl is printed with the following variable values.

Variable name

Variable value

item

O Ring

revision

V1

lot

123

serial_number

12345

lot_status

123

serial_number_status

Active

organization

A1

There will be 1 printed copy of the label with spooler job name Serial. The printer name is not specified in the XML file, so the label prints to the printer as defined in the label template.

SAP AII XML Specifications

NiceLabel Automation can present itself as an RFID device controller, capable of encoding RFID tags and printing labels. For more information about SAP AII XML specifications, see the document SAP Auto-ID Infrastructure Device Controller Interface on SAP web page.

To execute such command file, use the Run SAP AII XML Command File action.

Sample SAP AII XML

This is the SAP AII XML providing data for one label (note that there is only one <label> element).

<?xml version="1.0" encoding="UTF-8"?>
<Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="Command.xsd">
    <WriteTagData readerID="DEVICE ID">
        <Item>
            <FieldList format="c:\SAP Demo\SAP label.nlbl" jobName="Writer_Device20040929165746" quantity="1">
            <Field name="EPC">00037000657330</Field>
            <Field name="EPC_TYPE">SGTIN-96</Field>
            <Field name="EPC_URN">urn:autoid:tag:sgtin:3.5.0037000.065774.8</Field>
            <Field name="PRODUCT">Product</Field>
            <Field name="PRODUCT_DESCRIPTION">Product description</Field>
            </FieldList>
        </Item>
    </WriteTagData>
</Command>

When executing this sample SAP AI XML file, the label c:\SAP Demo\SAP label.nlbl is printed with the following variable values.

Variable name

Variable value

EPC

00037000657330

EPC_TYPE

SGTIN-96

EPC

urn:autoid:tag:sgtin:3.5.0037000.065774.8

PRODUCT

Product

PRODUCT_DESCRIPTION

Product description

There will be 1 printed copy of the label with spooler job name Writer_Device2004092916574. Printer name is not specified in the XML file, so the label will be printed using the printer that is defined in the label template.