Application.XMLScript Method |
Executes a BTXML Script.
Application.XMLScript(xmlScript, BtXMLSourceType, Messages)
Where:
xmlScript is a string containing the BTXML script file name or script to be executed.
BtXMLSourceType determines whether the xmlScript argument is a script or a file. It can be set to one of the following values: BtXMLScriptString or BtXMLScriptFile.
Messages returns one or more Message Objects.
Version |
BarTender 8.01 or higher |
Edition |
Enterprise Automation |
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.
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)
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