Application.OnCommandLineCompleted Event |
Occurs when a command line sent using the CommandLine method has completed.
Private Sub EventHandler(ByVal sResponseString As String, ByRef Messages As Messages, ByVal CommandLine As String) Handles Application.OnCommandLineCompleted
Where:
EventHandler is the name of the subroutine that is called when the event occurs.
sResponseString is the XML response message that is generated as BarTender processes a BTXML script message.
Messages is the object that contains all messages that occur during the processing of the command line.
CommandLine returns the command line that was completed.
Application.OnCommandLineCompleted+= new BarTender.IApplicationEvents_OnCommandLineCompletedEventHandler(EventHandler)
Where EventHandler is the name of the method that is called when the event occurs.
void EventHandler(string ResponseString, ref BarTender.Messages Messages, CommandLine As String){}
Where:
EventHandler is the name of the method that is called when the event occurs.
ResponseString is the XML response message that is generated as BarTender processes a BTXML script message.
Messages is the object that contains all messages that occur during the processing of the command line.
CommandLine returns the command line that was completed.
Version |
BarTender 9.01 or higher |
Edition |
Enterprise |
Module App_OnCommandLineCompleted
'Declare a BarTender application variable with support for events
Public WithEvents btApp As BarTender.Application
'Define the event handler
Private Sub OnCommandLineCompletedEventHandler(ByVal sResponseString As String, ByRef Messages As BarTender.Messages, ByVal CommandLine As String) Handles btApp.OnCommandLineCompleted
MsgBox(sResponseString)
Dim val As Integer
For val = 1 To Messages.Count
MsgBox("Message#" + Cstr(Messages.Item(val).Number) + vbCrLf + vbCrLf + Messages.Item(val).Message)
Next
End Sub
Public Sub DoOnCommandLineCompleted()
'Create a new instance of BarTender
btApp = CreateObject("BarTender.Application")
'Send a command line to load and print a document
btApp.CommandLine("/f=C:\Temp\Format1.btw /p")
'End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges)
End Sub
End Module
Event Handler:
public void OnCommandLineCompletedEventHandler(string ResponseString, ref BarTender.Messages Messages, string CommandLine)
{
MessageBox.Show("OnCommandLineCompleted Event: " + ResponseString);
Object oIndex;
BarTender.Message message;
for(int nMsgNum = 1; nMsgNum <= Messages.Count; ++nMsgNum)
{
oIndex = nMsgNum;
message = Messages.Item(ref oIndex);
MessageBox.Show("Message #" + message.Number.ToString() + "\r\n" + "\r\n" + message.Message);
}
}
Code that causes the Event:
public void DoOnCommandLineCompleted()
{
// Create a new instance of BarTender
BarTender.Application btApp = null;
btApp = new BarTender.Application();
// Register the event handler
btApp.OnCommandLineCompleted += new BarTender.IApplicationEvents_OnCommandLineCompletedEventHandler(OnCommandLineCompletedEventHandler);
// Send the command line
btApp.CommandLine("/XMLScript=\"C:\\Temp\\XMLScript.xml\"");
// End the BarTender process
btApp.Quit(BarTender.BtSaveOptions.btDoNotSaveChanges);
}
Related Topics