JOB Command File
JOB command file is text file that contains native Loftware printing commands. The commands execute in order from top to bottom. The sequence of commands usually starts with LABEL (open label). LABEL command is followed by SET (to set variable value), and finally by PRINT (print label).
JOB command file can be executed using the following actions:
JOB Command File Definition
Loftware commands are used in command files to control label printing. Desktop Designer executes the commands within command files from top to bottom.
If developing a command file, it is a good practice to document your commands. This helps you decode what the script really performs, when you check the code after some time. Use a semicolon (;) at the beginning of the line. Everything that follows the semicolon is treated as a comment and is not processed.
This command resets variable values to their default values.
This command creates a text file. You can use it to signal a third party application that the printing process has begun or ended, depending on the location where command is put. Use the UNC syntax for network resources. For more information, see section Access to Network Shared Resources in Loftware Automation user guide.
Deletes the specified file. Use UNC syntax for network resources. For more information, see section Access to Network Shared Resources in Loftware Automation user guide.
This command is implemented to automate the "Export to printer" command that is available in the label designer. The label is exported directly to the printer and stored in the memory for off-line printing. The user can recall the label using the keyboard on the printer or by sending a command file to the printer. The same functionality is available also with Store Label to Printer action.
Note
To specify the label for exporting, use the LABELcommand first.
ExportFileName. This parameter is mandatory and defines the file name of generated printer commands.
ExportVariant. Some printers support multiple export variants. If exporting them manually, the user can select the export variant in the dialog. With the EXPORTLABEL command, you must specify which export variant you want to use. The variants are visible in the label designer after you enable the Store/Recall printing mode.
The first variant in the list holds the value 0. The second variant has the value 1, etc.
If you do not specify any variant type, value 0 is used as default.
For more information about off-line printing, see topic Store/Recall Printing Mode.
Specifies that the below listed JOB file errors do not terminate the printing process:
Incorrect variable name is used.
Incorrect value is sent to a variable.
Label does not exist / is not accessible.
Printer does not exist / is not accessible.
The command opens a label to be printed. If the label is already loaded, it will not be re-opened. You can include the path name. Enclose the label name in double quotes, if the name or path contains spaces. Use UNC syntax for network resources. For more information, see topic Access to Network Shared Resources in Loftware Automation User Guide.
The optional parameter printer_name specifies the printer, for which the label will be opened. Use this setting if you want to override the printer name that is saved in the label template. If the driver for the provided printer name is not installed or not available, the command raises an error.
Logs the custom message into the trigger log. If the message contains space characters or commas, you have to enclose the text in double quotes (").
This command overrides port as defined in the printer driver and redirects printing to a file. If file path or file name contain spaces, enclose the value in double quotes ("). Use UNC syntax for network resources. For more information, see topic Access to Network Shared Resources in Loftware Automation User Guide.
The parameter APPEND is optional. By default, the file is overwritten. Use this parameter to append data into the existing file.
Once you use a PORT command in the JOB file, it remains valid until the next PORT command, or until the end of file (whichever comes first). If you use PRINTER command after the PORT command has been executed, the PORT setting overwrites the port defined for the selected printer. If you want to use the actual port that is defined for the selected printer, you have to use another PORT command with an empty value, such as PORT = "".
This command starts the print process.
Quantity. Specifies the number of labels to print.
<number>. Specified number of labels will print.
VARIABLE. Specifies that some label variable is defined as
variable quantity and will contain the number labels to print. The label will determine how many labels to print.UNLIMITED. If you use a database to acquire values for objects, unlimited printing will print as many labels as there are record in the database. If you do not use a database, the maximum number of labels that thermal printer internally supports will be printed.
Skip. Specifies the number of labels you want to skip on the first page. The parameter is used for printing labels on sheets of paper. When the part of the page has already been used, you can reuse the same sheet by Shifting the start location of the first label.
Identical label copies. Specifies how many copies of the same label must print.
Number of label sets. Specifies the number of times the whole printing process should repeat itself.
Note
Make sure the quantity values are provided as the numeric value, not string value. Do not enclose the value in the double quotes.
This command overrides the printer defined in the label file. If the printer name contains space characters, enclose it in double quotes (").
Use the printer name as displayed in the status line in the label design application. Printer names are usually the same as the printer names in Printers and Faxes from Control Panel, but not always. If using network printers, you might see the name displayed using syntax \\server\share.
This command specifies the print job name to be seen in Windows Spooler. If the name contains space characters or commas, you have to enclose the value in double quotes (").
This command closes the print stream. Also see SESSIONSTART.
Note
SESSIONEND
must be sent as the only item in Send Custom Command action. If you would like to send additional commands, use separate Send Custom Command actions.
This command prints the currently referenced label and adds it into the currently open session-print stream. You can use multiple SESSIONPRINT commands one after another and join the referenced labels in a single print stream. The stream does not close until you close it using the SESSIONEND command. The meaning of quantity and skip parameters is the same as with Loftware command PRINT. Also see SESSIONSTART.
Quantity. Specifies the number of labels to be printed.
Skip. Specifies the number of labels you want to skip on the first page. The parameter is used for printing labels on sheets of paper. If a part of the page has already been used, you can reuse the same sheet by Shifting the start location of the first label.
This command initiates the session-print type of printing.
The three session-print-related commands (SESSIONSTART, SESSIONPRINT, SESSIONEND) are used together. When you use command PRINT, every label data will be sent to the printer in a separate print job. If you want to join label data for multiple labels into print stream, you should use the session print commands. You must start with the command SESSIONSTART, followed with any number of SESSIONPRINT commands and in the end the command SESSIONEND.
Use these commands to optimize label printing process. Printing labels coming from one print job is much faster than printing labels from a bunch of print jobs.
There some rules you have to follow so the session print will not break.
You cannot change the label within a session.
You cannot change the printer within a session
You must set values for all variables from the label within a session, even if some of the variables will have empty values
This command assigns a value to the name variable. The variable must be defined on the label, or an error is raised. If the variable isn't on the label, an error occurs. Step and number of repetitions are parameters for counter variables. These parameters specify the counter increment and the number labels before the counter changes value.
If value contains spaces or comma characters, you must enclose the text in double quotes ("). Also see TEXTQUALIFIER.
If you want to assign multi-line value, use \r\n to encode newline character. \r is replaced with CR (Carriage Return) and \n is replaced with LF (Line Feed).
Be careful when setting values to variables that provide data for pictures on the label, as backslash characters might be replaced with some other characters.
Example
If you assign a value "c:\My Pictures\raw.jpg" to the variable, the "\r" will be replaced with CR character.
This command allows you to set fine-tune printer settings just before printing. The supported parameter for printer settings (paramname) are:
PAPERBIN. Specifies the tray that contains label media. If the printer is equipped with more than just one paper / label tray, you can control which is used for printing. The name of the tray should be acquired from the printer driver.
PRINTSPEED. Specifies the printing speed. The acceptable values vary from one printer to the other. See printer's manuals for exact range of values.
PRINTDARKNESS. Specifies the printing darkness / contrast. The acceptable values vary from one printer to the other. See printer's manuals for exact range of values.
PRINTOFFSETX. Specifies the left offset for all printing objects. The value for parameter must be numeric, positive or negative, in dots.
PRINTOFFSETY. Specifies the top offset for all printing objects. The value for parameter must be numeric, positive or negative, in dots.
PRINTERSETTINGS.Specifies the custom printer settings to be applied to the print job. The parameter requires the entire DEVMODE for the target printer, provided in a Base64-encoded string. The DEVMODE contains all parameters from the printer driver at once (speed, darkness, offsets and other). For more information, see topic Understanding printer settings and DEVMODE in Loftware Automation User Guide.
Note
The Base64-encoded string must be provided inside double quotes (").
Text-qualifier is the character that embeds data value that is assigned to a variable. Whenever data value includes space characters, it must be included with text-qualifiers. The default text qualifier is a double quote character ("). Because double quote character is used as shortcut for inch unit of measure, sometimes it is difficult to pass the data with inch marks in the JOB files. You can use two double quotes to encode one double quote, or use TEXTQUALIFIER.
Example
JOB Command File Example
This JOB file opens the label2.nlbl label, sets variable values and prints a single label. Because no PRINTER command is used to redirect printing, the label will be 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