Automation with BarTender XML Script

You can use BarTender XML (BTXML) script to easily automate BarTender while you provide third-party programmers with a simple way to integrate BarTender into their applications.

In some cases, an XML response is created after running the script, such as when you pass BTXML script to BarTender by using ActiveX Automation. An XML response gives you valuable information about the print job, the printer that was used to complete the job, the BarTender settings during the print job, and the details about the printed items. You can integrate this response with a custom application.

An XML response is returned when BTXML script is run by using the following methods:

For more information, refer to Using the XML Response.

You can run BTXML script by using any of the following methods.

ClosedCommand-Line Interface

BarTender's functions can be 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.

ClosedActiveX Automation

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's 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, respectively.

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

ClosedPrint 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 retuns the response. For more information, refer to the BarTender .NET SDK documentation.

BTXML scripts that are run by using the Print Scheduler 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.

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.

In This Section