Author Topic: Simple code for testing/trying AI code  (Read 12764 times)


  • EA Administrator
  • EA User
  • *****
  • Posts: 591
  • Karma: +7/-0
    • View Profile
Simple code for testing/trying AI code
« on: September 28, 2003, 06:10:20 pm »
Below is a simple set of code for testing or trying out commands when using the Automation Interface.

It uses the EaExample.eap file.  It is assumed a copy of this is stored in the default installation directory.

The following is some VBA/ VB 6 code for testing the command to generate the HTML report:

Sub Main()
   Dim rep As EA.Repository
   Dim Package As EA.Package
   Dim Diag As EA.Diagram
   Dim aPackageGuid As String
   Dim aProject As EA.Project
   Set rep = New EA.Repository
   'rep.OpenFile "C:\temp\EAExample.eap"
   rep.OpenFile "C:\Program Files\Sparx Systems\EA\EAExample.eap"
   'Using EA Version 3.51 ... Different EaExample
'   Set Package = rep.Models.GetByName("Views")
'   Set Package = Package.Packages.GetByName("Use Case View")
'   Set Package = Package.Packages.GetByName("Business Process Model")
'   Set Package = Package.Packages.GetByName("Process Model")
   'Using v3.60...EAexample
   Set Package = rep.Models.GetByName("Messenger")
   Set Package = Package.Packages.GetByName("Model Views")
   Set Package = Package.Packages.GetByName("Business Context Model")
   Set Package = Package.Packages.GetByName("Business Requirements Model")
   aPackageGuid = Package.PackageGUID
   'Place to test some commands..
   Set aProject = rep.GetProjectInterface()
   aProject.RunHTMLReport aPackageGuid, "C:\temp", "BMP", "", "htm"
   ' end test..
   Set rep = Nothing
End Sub

Please refer to for references on using the Automation Interface.