Custom Command Events

Custom command events occur when a custom command is executed.

ClosedCustom command event sequence

The following events occur when a document is selected.

  • <CommandName>_State

    The _State event determines what commands are available in the menu ribbon.

  • DocGenericEvent_OnProperties

The events that occur for custom commands are shown in the following list in the sequence that they occur.

  • DocGenericEvent_PrepareCommand

  • <CommandName>_PreInitialize

  • <CommandName>_Initialize

  • <CommandName>_BeforeWizard

  • <CommandName>_AfterWizard

  • <CommandName>_PreExecute

  • <CommandName>_Execute

  • <CommandName>_Terminate

Closed<CommandName>_State Event

Occurs when the client application is calculating which custom commands should be available in the main menu, ribbon, or context menu.

Syntax

<CommandName>_State(Mode)
Parameters
Name Description

Mode

Long integer that represents one or more AS_CMD_MODE constants.

Remarks

Use this event to set the status of the menu item to a long integer that represents one or more AS_CMD_STATE constants.

Closed<CommandName>_Initialize Event

Occurs before the command is executed.

Syntax

<CommandName>_Initialize(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Closed<CommandName>_BeforeWizard Event

Occurs before a wizard page is shown.

Syntax

<CommandName>_BeforeWizard(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Closed<CommandName>_AfterWizard Event

Occurs after a wizard page is shown.

Syntax

<CommandName>_AfterWizard(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Closed<CommandName>_Execute Event

Occurs when the command is executed.

Syntax

<CommandName>_Execute(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Remarks

Use this event to execute the main logic of the command.

Closed<CommandName>_PreExecute Event

Occurs before the command has been executed. This event is used to add a confirmation page to the command.

Syntax

<CommandName>_PreExecute(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Remarks

Refer to the AskConfirmation method documentation for the Batch object to learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.

Closed<CommandName>_PreInitialize Event

Occurs before the command is initialized. This event is used to add a confirmation page to the command.

Syntax

<CommandName>_PreInitialize(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

Remarks

Refer to the AskConfirmation method documentation for the Batch object to learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.

Closed<CommandName>_Terminate Event

Occurs after the command has executed.

Syntax

<CommandName>_Terminate(Batch)
Parameters
Name Description

Batch

An object that represents the batch of documents the user has selected.

2021 R2