Register events only in certain applications

By default powerEvents is loaded in every application that uses the Autodesk.Connectivity.WebServices.dll. This causes the powerEvents event scripts to be executed. If there is a Register-VaultEvent in the script the splashscreen shows up. It's not required to register events in some applications and the splashscreen can prevent the user from working as long as it is visible.

 

It is possible not to register powerEvents events in specific applications to prevent the splashscreen from showing up.

The module Common.psm1 which is delivered with powerEvents and loaded by default allows you to use the variable $processName in powerEvents scripts. It contains the name of the process where powerEvents is currently loaded.

You can use this variable to define conditions for the Register-VaultEvent cmdLet to be executed.

Please note that if you have multiple event scripts this has to be used in every event script where Register-VaultEvent is called.

Use a list of allowed process names

This example uses a list of allowed process names in which the events are registered. It allows registering events in Vault Professional, Inventor and the Powershell ISE.

$allowedApplications = @("Connectivity.VaultPro", "Inventor", "powershell_ise")
if ($allowedApplications -contains $processName) {
Register-VaultEvent -EventName UpdateFileStates_Restrictions -Action 'CanTriggerDwfJob'
Register-VaultEvent -EventName UpdateFileStates_Post -Action 'AddDwfJob'
}
 

Prevent loading in one application

This example prevents powerEvents from loading in AutoCAD.

if ($processName -ne "acad") {
Register-VaultEvent -EventName UpdateFileStates_Restrictions -Action 'CanTriggerDwfJob'
Register-VaultEvent -EventName UpdateFileStates_Post -Action 'AddDwfJob'
}
 

See Also