Using BTXML Script

BTXML script is an XML schema that was created specifically to work with BarTender. You can use BTXML script to control and automate BarTender and print jobs, and you can send BTXML script to your external software applications to run BarTender and print BarTender documents. You can create BTXML script as a script or as a file and then send the script or file 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.

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

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

ClosedBarTender REST API

Use the BarTender REST API to access REST endpoints that you can use to automate your system on a Windows or non-Windows platform. You can use the API to configure a Print BTXML Script action to pass your BTXML script to BarTender to print one or more documents.

After the script runs, the Response variable contains the BTXML response. You can query the Response variable value by using the GET /api/actions/{Id}/variables/Response command. In this command, {Id} is the "Id" property in the JSON string that is returned when the script is submitted.

For more information about how to use the BarTender REST API, refer to Using the BarTender REST API in the BarTender help system.

ClosedBarTender .NET 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 interface (API) that supports BTXML script.

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 that is installed with BarTender.

BTXML scripts that are run by using the Print Scheduler API return an XML response.

ClosedLegacy Methods

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

ClosedActiveX 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.

ClosedCommand-Line Interface

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 BTXML 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 BTXML 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.

ClosedPrint 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.

BTXML scripts that are run by using the Print Engine API return an XML response.

ClosedPrint 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.

BTXML scripts that are run by using the Print Server API return an XML response.

In This Section