Application.OnCommandLineCompleted Event

ClosedDescription

Occurs when a command line sent using the CommandLine method has completed.

ClosedVB.NET Syntax

Private Sub EventHandler(ByVal sResponseString As String, ByRef Messages As Messages, ByVal CommandLine As String) Handles Application.OnCommandLineCompleted

Where:

ClosedC# Event Connection Syntax

Application.OnCommandLineCompleted+= new BarTender.IApplicationEvents_OnCommandLineCompletedEventHandler(EventHandler)

Where EventHandler is the name of the method that is called when the event occurs.

ClosedC# Event Callback Signature

void EventHandler(string ResponseString, ref BarTender.Messages Messages, CommandLine As String){}

Where:

ClosedRequirements

Version

BarTender 9.01 or higher

Edition

Enterprise Automation

ClosedVB.NET Example

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

ClosedC# Example

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