Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: m2i7c9k on July 24, 2021, 12:34:01 am

Title: VBScript create package with Exclude from Generated Report
Post by: m2i7c9k on July 24, 2021, 12:34:01 am
Hi Guys,

is it possible to create the package by VBScript with "Exclude from Generated Report"?

sub main

   dim i

   dim msg
   dim iBox
   dim appName
   appName = "Package"
   
   dim thePackage as EA.Package
   set thePackage = Repository.GetTreeSelectedPackage()

   dim theElement as EA.Element
   set theElement = Repository.GetTreeSelectedObject()

   dim packages as EA.Collection
   set packages = thePackage.Packages
   
   dim elements as EA.Collection
   set elements = thePackage.Elements

   dim subPackage as EA.Package
   set subPackage = packages.AddNew("[data]", "Class")
        subPackage.what?
   subPackage.Update()
         
         
   Repository.Models.Refresh()
end sub

Thanks for HELP :)

Mick
Title: Re: VBScript create package with Exclude from Generated Report
Post by: m2i7c9k on July 24, 2021, 01:43:12 am
OK I got it :)

option explicit

!INC Local Scripts.EAConstants-VBScript

'
' Script Name: createAnalyticalService Diagram
' Author: Milan Hudec
' Purpose: N/A
' Date: streda, 17 marca 2021, 15:46:45
'
sub main

   dim i

   dim msg
   dim iBox
   dim appName
   appName = "Package"
   
   dim thePackage as EA.Package
   set thePackage = Repository.GetTreeSelectedPackage()

   dim theElement as EA.Element
   set theElement = Repository.GetTreeSelectedObject()

   dim packages as EA.Collection
   set packages = thePackage.Packages
   
   dim elements as EA.Collection
   set elements = thePackage.Elements

   dim subPackage as EA.Package
   set subPackage = packages.AddNew("[data - t]", "Class")
   subPackage.Update()
   
   dim theNewPackage as EA.Element
   set theNewPackage = Repository.GetTreeSelectedObject()
   theNewPackage.update()
   Session.Output  ( theNewPackage.PackageID & " - " & theNewPackage.name )
   
   dim updatequery
   updatequery = "UPDATE t_package SET PackageFlags = 'RTF=F;' WHERE t_package.Package_ID = " & subPackage.PackageID
   Repository.Execute updatequery

   Repository.Models.Refresh()
end sub

main