Document Copy/Move Events
Some events occur when documents are moved or created as copied, derived, or replacement documents.
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 1
-
DocCopyMoveEvent_PreInitializeCopy
-
DocCopyMoveEvent_InitializeCopy 2
-
DocCopyMoveEvent_InitializeDerive 3
-
DocCopyMoveEvent_InitializeReplace 4
-
DocGenericEvent_InitializeNewDocument
-
DocGenericEvent_InitializeCalculateFileName
-
DocCopyMoveEvent_PreBeforeCopyWithReferences
-
DocCopyMoveEvent_BeforeCopyWithReferences 5
-
DocCopyMoveEvent_PreBeforeCopy7
-
DocCopyMoveEvent_BeforeCopy 2
-
DocCopyMoveEvent_AfterCopy 2
-
DocCopyMoveEvent_BeforeDerive 3
-
DocCopyMoveEvent_AfterDerive 3
-
DocCopyMoveEvent_BeforeReplace 4
-
DocCopyMoveEvent_AfterReplace 4
-
DocGenericEvent_BeforeNewDocument
-
DocGenericEvent_OnProperties 6
-
DocGenericEvent_AfterNewDocument
-
DocCopyMoveEvent_AfterCopyWithReferences 5
-
DocGenericEvent_TerminateCalculateFileName
-
DocGenericEvent_TerminateNewDocument
-
DocCopyMoveEvent_TerminateCopy 2
-
DocCopyMoveEvent_TerminateDerive 3
-
DocCopyMoveEvent_TerminateReplace 4
Notes
-
Source document only.
-
Copy and Paste commands only.
-
Derive command only.
-
Replace command only.
-
Copy with References command and Derive with References commands only.
-
Except Paste command.
-
PreBeforeCopy is not called when executing Copy with References. Copy with References will call PreBeforeCopyWithReferences.
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
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_*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.
DocCopyMoveEvent_*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.
DocCopyMoveEvent_*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.
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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
DocCopyMoveEvent_*Replace Events
Occurs when documents are replaced.
Syntax
DocCopyMoveEvent_*Replace(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. |
DocCopyMoveEvent_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.
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |
DocCopyMoveEvent_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. |