Chapter 3 Getting Started with Objects Manipulation Using Scripts


Opening a Model Using Scripts

You open a model using the OpenModel (filename As String, flags As Long =omf_Default) As BaseObject global function.

Example

Option Explicit
' Call the OpenModel global function with the following parameters:
'  - The model file name
'  - The default diagram will not be opened in a window
'  - The opened model will not appear in the workspace
Dim ExistingModel, FileName
FileName = "c:\temp\MySampleModel.oom"
On Error Resume Next          ' Avoid generic scripting error message like 'Invalid File Name   
Set ExistingModel = OpenModel(FileName, omf_DontOpenView Or omf_Hidden)
On Error Goto 0               ' Restore runtime error detection
If ExistingModel is nothing then
   msgbox "Fail to open UML Model:" + vbCrLf + FileName, vbOkOnly, "Error"    ' Display an error message box
Else
   output "The UML model has been successfully opened"    ' Display a message in the application output window
End If

 


Copyright (C) 2006. Sybase Inc. All rights reserved.