XML Command File
The commands available in the XML Command Files form a subset of Loftware commands. You can use the following commands:
- LOGIN
- LABEL
- SET
- PORT
- PRINTER
- SESSIONSTART
- SESSIONEND
- SESSIONPRINT
The syntax requires minor adaptation if used in an XML file.
XML command file can be executed using the following actions:
The root element in the XML Command file is <Nice_Commands>. The next element that must follow is <Label>– it specifies the label to be used.
Two methods are available to start the label printing:
Print the labels normally using the <Print_Job> element.
Print the labels in a session using the <Session_Print_Job> element.
You can also change the printer using which the labels are going to be printed, and set the variable value.
XML Command File Definition
This section defines 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. For 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 open, it won't be re-opened. The label file must be accessible from this computer. For more information, see the topic Access to Network Shared Resources in Loftware Automation user guide. This element can occur several times within the command file.
Name. This attribute contains label name. You can include the path to the label name. Mandatory element.
<Print_Job>. The element that contains data for one 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 the topic Access to Network Shared Resources. Optional element.
Quantity. Use this attribute to specify the number of labels to print. Possible values: numeric value, VARIABLE or UNLIMITED. For more information on parameters, see the topic Print Label. Mandatory element.
Skip. Use this attribute to specify the number of skipped labels at the beginning. This feature is useful if you print sheet of labels to laser printer, but the sheet is partial already printed. For more information, see the topic Print Label. Optional element.
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 the topic Set Print Job Name. Optional element.
Print_to_file. Use this attribute to specify the file name where you want to save the printer commands. For more information, see the topic Redirect Printing to File. Optional element.
Identical_copies. use this attribute to specify the number of copies you need for each label. For more information, see the topic Print Label. Optional element.
<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 element <Print_Job>. All of them are valid, you just cannot use the quantity attribute. See the description of the element <Session> to find out how to specify label quantity in session printing.
Store_job. Use this attribute to store your label to the printer. For more information, see the topic Store Label to Printer.
Store_name. With this value, you store your label to the printer. Optional element.
Store_variant. Storage unit where you store your label (USB memory, SD card, DRAM). See your printer driver settings for the exact names. Optional element.
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 the topic Set Print Job Name. Optional element.
Note
To Recall labels from your printer use the same elements as for printing.
When job_name element is empty the label name element value is used to recall the correct label from the printer's memory.
<Session>. The element that contains data for a single session. When printing in session, all labels are encoded into a single print job and are sent to the printer as one job.
Quantity. Use this attribute to specify the number of labels to print. Possible values: numeric value, string VARIABLE, or string UNLIMITED. For more information on parameters, see the topic Print Label. Required.
Skip. Specifies the number of labels that are skipped on the first page of labels. The sheet of labels might have been printed once already, but not entirely. You can re-use the same sheet by offsetting the starting position. This option is applicable, if you print labels to sheets of labels, not rolls of labels, so it's effective for office printers and not for label printers. Possible values: numeric value or string VARIABLE. For more information on parameters, see the topic Print Label. Optional.
Identical_copies. Specifies the number of label copies to be printed for each unique label. For fixed labels, this option produces the same result as the main Number of Labels option. For variable labels, such as labels using counters, you can get the real label copies. Possible values: numeric value or string VARIABLE. For more information on parameters, see the topic Print Label. Optional.
Number_of_sets. Specifies how many times the entire label printing process should repeat. Possible values: numeric value or string VARIABLE. For more information on parameters, see the topic Print Label. Optional.
<Variable>. The element that sets the value of variables 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/X MLSchema"> <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:attribute name="skip" type="xs:string" use="optional" /> <xs:attribute name="identical_copies" type="xs:string" use="optional" /> <xs:attribute name="number_of_sets" type="xs:string" use="optional" /> </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>
XML Command File Example
The sample below presents the structural view on 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" skip="2" identical_copies="1" number_of_sets="4"> <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>
This sample presents storing a label to the printer.
<nice_commands> <label name="label1.nlbl" close="false"> <store_job store_name="label011" store_variant= "DRAM" printer="Zebra R-402" job_name="recall011"> <variable name="country" >Slovenia</variable> <variable name="packaging_type" >big box</variable> <variable name="Warehouse_no" >3</variable> </store_job> </label> </nice_commands>