Application.XMLScript Method

ClosedDescription

Runs a BTXML script.

ClosedSyntax

Application.XMLScript(xmlScript, BtXMLSourceType, Messages)

Where:

ClosedRequirements

Version

BarTender 8.01 or higher

Edition

Enterprise

ClosedRemarks

BTXML script provides a method for you to automate BarTender print jobs by using XML tags. The method invokes a BTXML script command to print a document or export it as an image file. It returns an XML response value with the BSTR string type. The 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. The BTXML response is not returned in the Messages collection.

ClosedVB.NET Example

The following Visual Basic example references an XML file that is named Print_Product_Label.xml.

'Declare a BarTender application variable

Dim btApp As BarTender.Application

'Declare a BarTender messages variable to hold all messages

Dim btMessages As BarTender.Messages = Nothing

'Create a new instance of BarTender

btApp = New BarTender.Application

'Set the BarTender application visible

btApp.Visible = True

'Run the XML file

btApp.XMLScript("c:\XMLFiles\Print_Product_Label.xml", BarTender.BtXMLSourceType.btXMLScriptFile, btMessages)

'Display all messages that are returned by the BTXML script

Dim msg As BarTender.Message

For Each msg In btMessages

MessageBox.Show(msg.Message)

Next msg

'End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)

ClosedC# Example

The following C# example references an XML file that is named Print_Product_Label.xml.

// Declare a BarTender application variable

BarTender.Application btApp;

// Declare a BarTender messages variable

BarTender.Messages btMessages;

// Create a new instance of BarTender

btApp = new BarTender.Application();

// Set the BarTender application visible

btApp.Visible = true;

// Run the XML file

btApp.XMLScript(@"c:\XMLFiles\Print_Product_Label.xml", BarTender.BtXMLSourceType.btXMLScriptFile, out btMessages);

// Display all messages that are returned by the BTXML script

foreach(BarTender.Message msg in btMessages)

{

MessageBox.Show(msg.Message);

}

// End the BarTender process

btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);

Related Topics