Automation with BarTender XML Script

You can use BarTender XML (BTXML) script to automate BarTender and also to provide third-party programmers with a way to integrate BarTender into their applications. You can create BTXML script as a script or as a file and then send it to BarTender by using any of the following methods:

Some methods return an XML response when you run BTXML script. An XML response gives you valuable information about the print job, the printer that was used to complete the job, the BarTender settings that were used during the print job, and details about the printed items. You can integrate this response with a custom application. For more information, refer to Using the XML Response.

ClosedIntegration Builder Integration Files

By using Integration Builder, you can create an integration file that contains a Print BTXML Script action that you can configure to pass your BTXML script to BarTender to print one or more documents.

For more information about how to create integration files, refer to the Integration Builder help system.

BTXML scripts that are run by using a Print BTXML Script action return an XML response.

ClosedProcess Builder Process Files

Process Builder is a BarTender companion application that you can use to create customizable process files so that you can automate repetitive operations. You can use a Print BTXML Script action to pass your BTXML script to BarTender to print one or more documents.

BTXML scripts that are run by using a Print BTXML Script action return an XML response.

For more information about how to create process files, refer to the Process Builder help system.

ClosedBarTender SDK

The BarTender .NET software development kit (SDK) interfaces with any .NET language and supports task-based concurrent label printing for high-demand environments, such as web servers. It includes the following application programming interfaces (APIs) that support BTXML script.

BTXML scripts that are run by using the following APIs return an XML response.

Print Scheduler API

Use the Print Scheduler API to run BTXML script through the BtXmlAction class, which is available for use in both C# and VB.NET. To do this, create the action, set the properties that are required to complete the action, and then call either the Run or the RunSynchronous method. The Run method returns a response immediately and allows the client to do other work while the submitted action is running. The RunSynchronous method submits the action to the server and then waits for it to finish before it returns the response. For more information, refer to the BarTender .NET SDK documentation.

Print Server API

Use the Print Server API to run BTXML script through the XMLScriptTask class, which is available for use in both C# and VB.NET. For more information, refer to the BarTender .NET SDK documentation.

Print Engine API

You can run BTXML in the Print Engine API by using the Engine class XMLScript method. This method passes either a BTXML script string or the path and file name of a file that contains BTXML script.

ClosedCommand-Line Interface

This method should be used only for testing or for backwards compatibility.

You can specify that functions in BarTender are performed automatically when BarTender starts by passing BTXML script via the command line. The BTXML script must be passed as a string or a file, and the /XMLScript parameter must be the last argument on the command line.

The following example shows the correct structure for passing a BTXML script string to BarTender for processing (where btxml_script is the BarTender XML code to run):

/XMLScript="btxml_script"

The following example shows the correct structure for passing a BTXML script file to BarTender for processing (where btxml_file is the path and file name of the file that contains the BarTender XML code to run):

/XMLScript="btxml_file"

For more information about how to use the command line, refer to Command Line Parameter Reference.

BTXML scripts that are run through the command line do not return or save an XML response.

ClosedLegacy Methods

The following methods are superseded by newer technologies and should be used for backwards compatibility only.

ActiveX Automation

ActiveX is a legacy technology and should not be used to develop new products. By using a programming or scripting language, such as Visual Basic or C#, you can pass BTXML scripts to BarTender by using ActiveX Automation. To do this, use the Application object XMLScript method.

For more information about how to automate BarTender by using ActiveX Automation and the Application object, refer to Automation with ActiveX and Using the Application Object.

BTXML scripts that are run by using ActiveX Automation return an XML response.

Command-Line Interface

The command-line interface is a legacy technology and should not be used to develop new products. It should be used only for testing, as described in the previous section.

In This Section