Application.XMLScript Method

ClosedDescription

Executes a BTXML Script.

ClosedSyntax

Application.XMLScript(xmlScript, BtXMLSourceType, Messages)

Where:

ClosedRequirements

Version

BarTender 8.01 or higher

Edition

Enterprise Automation

ClosedRemarks

BTXML Script provides a means of automating BarTender printing through the use of XML tags. The method invokes BTXML Script command to print a document or export it as an image file. It returns an XML response value with the type of BSTR string. The XML response provides you with valuable information about the print job, the printer used to complete the job, BarTender's settings during the print job, and complete details about the printed items. The BTXML response is not returned in the Messages collection.

ClosedVB.NET Example

The Visual Basic example references an xml file 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

'Execute the xml file

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

'Display all messages 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 C# example references an XML file 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;

// Execute the xml file

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

// Display all messages 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