Document Copy/Move Events
Some events occur when documents are moved or created as copied, derived, or replacement documents.
Events which have an asterisk (*) in their name in the expanding sections below also have precursor events which occur prior to the main event. For example, the PreBeforeCopy event occurs before the BeforeCopy event. Both the precursor event and its subsequent event are described in the same expanding section.
Document Copy/Move Event Sequences
The events that occur for the document copy and move commands are shown in the following lists in the sequence that they occur.
Copy, Paste, Derive, Replace event sequence
-
DocCopyMoveEvent_PrepareCopy — Source document only.
-
DocCopyMoveEvent_PreInitializeCopy
-
DocCopyMoveEvent_InitializeCopy — Copy and Paste commands only.
-
DocCopyMoveEvent_InitializeDerive — Derive command only.
-
DocCopyMoveEvent_InitializeReplace — Replace command only.
-
DocGenericEvent_InitializeNewDocument
-
DocGenericEvent_InitializeCalculateFileName
-
DocCopyMoveEvent_PreBeforeCopyWithReferences
-
DocCopyMoveEvent_BeforeCopyWithReferences — Copy with References command and Derive with References commands only.
-
DocCopyMoveEvent_PreBeforeCopy — PreBeforeCopy is not called when executing Copy with References. Copy with References will call PreBeforeCopyWithReferences.
-
DocCopyMoveEvent_BeforeCopy — Copy and Paste commands only.
-
DocCopyMoveEvent_AfterCopy — Copy and Paste commands only.
-
DocCopyMoveEvent_BeforeDerive — Derive command only.
-
DocCopyMoveEvent_AfterDerive — Derive command only.
-
DocCopyMoveEvent_BeforeReplace — Replace command only.
-
DocCopyMoveEvent_AfterReplace — Replace command only.
-
DocGenericEvent_BeforeNewDocument
-
DocGenericEvent_OnProperties — Except Paste command.
-
DocGenericEvent_AfterNewDocument
-
DocCopyMoveEvent_AfterCopyWithReferences — Copy with References command and Derive with References commands only.
-
DocGenericEvent_TerminateCalculateFileName
-
DocGenericEvent_TerminateNewDocument
-
DocCopyMoveEvent_TerminateCopy — Copy and Paste commands only.
-
DocCopyMoveEvent_TerminateDerive — Derive command only.
-
DocCopyMoveEvent_TerminateReplace — Replace command only.
Move event sequence
-
DocCopyMoveEvent_InitializeMove
-
DocGenericEvent_InitializeNewDocument
-
DocGenericEvent_InitializeCalculateFileName
-
DocCopyMoveEvent_BeforeMove
-
DocCopyMoveEvent_AfterMove
-
DocGenericEvent_BeforeNewDocument
-
DocGenericEvent_OnProperties
-
DocGenericEvent_AfterNewDocument
-
DocGenericEvent_TerminateCalculateFileName
-
DocGenericEvent_TerminateNewDocument
-
DocCopyMoveEvent_TerminateMove
AfterCopy Event
Occurs after documents are copied and pasted. Applies to Copy and Paste commands only.
Syntax
DocCopyMoveEvent_AfterCopy(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
AfterCopyWithReferences Event
Occurs after documents are copied with references. Applies to Copy with References command and Derive with References commands only.
Syntax
DocCopyMoveEvent_AfterCopyWithReferences(Batch, SourceDocument, OldParentDocument, NewParentDocument)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
SourceDocument |
An object that represents the source document. |
OldParentDocument |
An object that represents the parent document of the source documents. |
NewParentDocument |
An object that represents the parent document of the copied documents. |
AfterDerive Event
Occurs after documents are derived. Applies to Derive command only.
Syntax
DocCopyMoveEvent_AfterDerive(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
AfterMove Event
Occurs after documents are moved.
Syntax
DocCopyMoveEvent_AfterMove(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
AfterReplace Event
Occurs after documents are replaced.
Syntax
DocCopyMoveEvent_AfterReplace(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
*BeforeCopy Event
Occurs before documents are copied. The PreBeforeCopy event can be used to add a confirmation page before the BeforeCopy event. This event can be used as part of a wizard.
PreBeforeCopy is not called when executing the Copy with References command. Copy with References will call PreBeforeCopyWithReferences.
Syntax
DocCopyMoveEvent_*BeforeCopy(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
Remarks
Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.
*BeforeCopyWithReferences Event
Occurs before documents are copied with references. Applies to Copy with References command and Derive with References commands only.
The PreBeforeCopyWithReferences event occurs before the BeforeCopyWithReferences event. PreBeforeCopyWithReferences can be used to add a confirmation page before the Copy with References Wizard.
Syntax
DocCopyMoveEvent_*BeforeCopyWithReferences(Batch, OldParentDocument, NewParentDocument, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
OldParentDocument |
An object that represents the parent document of the source documents. |
NewParentDocument |
An object that represents the parent document of the copied documents. |
TargetFolder |
An object that represents the destination folder. This event can modify the destination folder. |
Remarks
When a project copy is made of an assembly, this event occurs for all documents in the assembly, even those that are not copied but stay referenced. This can occur if the Default Duplicator Action option of the document type is set to Reference the source instead of Reference the copies (which were made by the command). You can confirm which documents were actually copied by checking the value of the TargetFolder parameter, which will be empty for the documents that were not copied.
Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.
*InitializeCopy Event
Occurs when documents are copied. Applies to Copy and Paste commands only.
The PreInitializeCopy event can be used to add a confirmation page before the InitializeCopy event. PreInitializeCopy can also be used as part of a wizard.
Syntax
DocCopyMoveEvent_*InitializeCopy(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
Remarks
Learn how to create confirmation pages. You can also see examples of this functionality in this Knowledgebase article.
InitializeDerive Event
Occurs when documents are derived. Applies to Derive command only.
Syntax
DocCopyMoveEvent_InitializeDerive(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
InitializeMove Event
Occurs when documents are moved.
Syntax
DocCopyMoveEvent_InitializeMove(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
InitializeReplace Event
Occurs when documents are replaced. Applies to Replace command only.
Syntax
DocCopyMoveEvent_InitializeReplace(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
PrepareCopy Event
Occurs before a batch of documents are copied by various Meridian commands, but unlike other initialization events, it occurs for the current document in the batch.
Syntax
DocCopyMoveEvent_PrepareCopy (Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. This event can modify the destination folder. |
Example
The following example demonstrates how to assign a project copy to a known project folder (retrieved from a document property, for example) and how to suppress the Select Folder and Reference Explorer (for reference selection if references exist) dialog boxes.
Sub DocCopyMoveEvent_PrepareCopy(Batch, TargetFolder) If Not Document Is Nothing Then If Client.ImportType = AS_IT_COPIED And Client.ImportDetails = AS_ID_CREATEPROJCOPY Then 'Add your code for document objects TargetFolder = "\Design\Projects\894" 'Or some property value 'Suppress folder selection dialog Client.Confirmation(AS_CONFIRM_PROJECT_FOLDER) = False 'Suppress reference selection dialog Client.Confirmation(AS_CONFIRM_SELECT_ASSEMBLY_ITEMS) = False End If ElseIf Not Folder Is Nothing Then 'Add your code for folder objects End If End Sub
SelectTarget Event
Occurs when a document is copied by the Import Documents, Copy (simple), Derive, and Replace commands. This event can be used to show the user a dialog box for folder, projects, or no dialog box.
Syntax
DocCopyMoveEvent_SelectTarget (Batch, TargetFolder, DialogToShow)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. This event occurs once for each document in the batch. |
TargetFolder |
An object that represents the default destination folder. This event can set the destination folder. |
DialogToShow |
The type of dialog box to show for folder selection, one of the AS_SELECT_DIALOG_TYPE constants. |
Remarks
The Document object in this event is the source document. This event is equivalent to the AS_CONFIRM_NO_SELECTPROJECTWIZARD constant. For the corresponding event for newly created documents, see DocGenericEvent_SelectTarget event.
TerminateCopy Event
Occurs when a copy event is terminated. Applies only to Copy and Paste commands.
Syntax
DocCopyMoveEvent_TerminateCopy(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
TerminateDerive Event
Occurs when document derive event is terminated. Applies to Derive command only.
Syntax
DocCopyMoveEvent_TerminateDerive(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
TerminateMove Event
Occurs when document move event is terminated.
Syntax
DocCopyMoveEvent_TerminateMove(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |
TerminateReplace Event
Occurs when document replace event is terminated. Applies to Replace command only.
Syntax
DocCopyMoveEvent_TerminateReplace(Batch, TargetFolder)
Name | Description |
---|---|
Batch |
An object that represents the batch of documents the user has selected. |
TargetFolder |
An object that represents the destination folder. |