Two vbs scripts are provided to customers as reference examples for implementing OnOKBefore/OnOKAfter events logic in MWPDM Service. They are sample templates and may require adaptation to each customer environment, configuration, security policy, and governance model before production use.
These two scripts extend the OnOKBefore and OnOKAfter MWPDM events framework. The first script focuses on the standard DWG/AutoCAD approval workflow, while the second provides advanced capabilities such as title block synchronization, bidirectional database data exchange etc...
Distribution
1)<INSTALL_DIR>\integration_autocad\DBAutocad\OnOkHooG.vbs
2)<GPP>\LST\system\OnOKHookG_Dwg_word_sample.vbs
Activation
For production use, either script must be renamed to OnOkHookG.vbs. The active file must be saved at <GPP>\LST\SYSTEM\OnOkHookG.vbs. Alternatively, the encrypted version ONOkHookG###.vbs can be used.
When OnOkHookG.vbs (or OnOkHookG###.vbs) is present in the target location,
it is possible to intercept the OnOkBefore and/or OnOkAfter events.
This allows different custom logic to run based on the event type,
helping standardize approval processes, automate technical updates, and reduce manual user activities.
OnOKHookG.vbs example
This script can be triggered during the MWPDM OnOKBefore/OnOKAfter events and is designed to automate AutoCad DWG approval handling. It validates document eligibility, checks revision consistency, and updates key database fields, including the Released state. It then opens and saves the DWG file to force a metadata refresh and keep file properties aligned with database values. During execution, it manages file lock/unlock operations to reduce conflicts between users and connected applications. If a file is read-only, the script temporarily enables write access and restores the original protection afterward. For reliable operation, the environment should include a properly configured MWPDM setup, valid file access permissions, and AutoCAD availability. The expected outcome is a more consistent and secure approval workflow with reduced manual intervention and fewer synchronization issues.
Starting from R26 SP 0.1 the Powershell version is distributed under <GPP>\LST\demo\demo_ps1\OnOkHookG folder and the Python version under <GPP>\LST\demo\demo_py\OnOkHookG folder.
OnOKHookG_Dwg_word_sample.vbs example
This script can be triggered during the MWPDM OnOKBefore/OnOKAfter events and provides an extended approval workflow for DWG documents. For approved DWG revisions, it updates revision and status data, then refreshes the drawing either through AutoCAD or through configured title-block synchronization logic. It supports bidirectional data handling, meaning drawing attributes can be updated from database values and, where configured, written back to the database.The script also applies controlled file lock/unlock operations to protect data integrity in multi-user environments. When required, it temporarily removes read-only protection, performs updates, and restores the original file protection state. Its conditional design ensures that only eligible files and approved revisions are processed, reducing unintended changes. The overall benefit is a richer, more automated release workflow with stronger metadata consistency across documents, drawings, and database records.
Starting from R26 SP 0.1 the Powershell version is distributed under <GPP>\LST\demo\demo_ps1\OnOkHookG folder and the Python version under <GPP>\LST\demo\demo_py\OnOkHookG folder.