Sparx Systems Forum

Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: Freddy_ on March 14, 2014, 02:16:53 am

Title: Automate creation of baseline
Post by: Freddy_ on March 14, 2014, 02:16:53 am
Hello everyone

I'm a EA scripting newbie :)
Does somebody know, if it's possible to create EA baselines within a VBScript (running outside of EA)? I would like to run this script as a scheduled task...

I've tried the following script, but CreateBaseline always returns false:

Call RunTest()

Sub RunTest()
On Error Resume Next

      ''create the repository object
      Dim rep
      Set rep = CreateObject("EA.Repository")
      ''open an EAP file
      If Not IsNothing(rep) Then
            Dim conString
            conString = "DBType=1;Connect=Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=<MyDB>;Data Source=<MyServer>;LazyLoad=1;"
            If rep.OpenFile(conString) Then
                  Dim proj
                  Set proj = rep.GetProjectInterface()
            
                  If Not proj.CreateBaselineEx(proj.GUIDToXML("{11111111-1111-1111-1111-111111111111}"), Format(Now, "yyyy-mm-dd"), "Auto created baseline.", 1) Then
                        MsgBox "Error creating baseline."
                  End If
            End If

            ''close the repository and tidy up
            Call rep.Exit()
      End If
      rep = Nothing
End Sub


My Enterprise Architect version is 10.0.1005

Thanks, Freddy
Title: Re: Automate creation of baseline
Post by: qwerty on March 14, 2014, 02:47:06 am
I doubt that the supplied package guid really exist. Try to replace it with a real package guid obtained by context menu: copy reference/guid.

q.
Title: Re: Automate creation of baseline
Post by: Freddy_ on March 14, 2014, 07:34:04 pm
Thanks for the reply...
The supplied guid is a dummy guid for this post; actually I got the real guid the same way you proposed...
Title: Re: Automate creation of baseline
Post by: qwerty on March 14, 2014, 09:59:34 pm
I replaced the Format statement above with a simple string and then it worked.

q.
Title: Re: Automate creation of baseline
Post by: Freddy_ on March 18, 2014, 12:40:49 am
My fault; Format does not exist in VBScript :( ...
Without Format the script runs as expected!
Thanks for the help!