I found the following in the PD Documentation and it is so essential that i need to share it !
VBScript programs and OLE Automation programs are very similar. You can easily create VB or VBA programs, if you know how to use VBScript. However, some differences remain. The following example program highlights what differentiates OLE Automation from VBScript.
The following VBScript program allows you to count the number of classes defined in an OOM and display that number in PowerDesigner Output window, then create a new OOM and display its name in the same Output window.
To do so, the following steps are necessary:
'* Purpose: This script displays the number of classes defined in an OOM in the output window.
Option Explicit
' Main function
' Get the current active model
Dim model
Set model = ActiveModel
If model Is Nothing Then
MsgBox "There is no current model."
ElsIf Not Model.IsKindOf(PdOOM.cls_Model) Then
MsgBox "The current model is not an OOM model."
Else ' Display the number of classes
Dim nbClass
nbClass = model.Classes.Count
Output "The model '" + model.Name + "' contains " + CStr(nbClass) + " classes."
' Create a new OOM
Dim model2
set model2 = CreateModel(PdOOM.cls_Model)
If Not model2 Is Nothing Then
' Copy the author name
model2.author = model.author
' Display a message in the output window
Output "Successfully created the model '" + model2.Name + "'."
Else
MsgBox "Cannot create an OOM."
End If
End If
To do the same with OLE Automation program, you should modify it as follows:
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
5 | |
4 | |
3 | |
3 | |
3 | |
3 | |
3 | |
3 | |
2 | |
2 |