Author Topic: Automate creation of baseline  (Read 5467 times)

Freddy_

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Automate creation of baseline
« 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

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Automate creation of baseline
« Reply #1 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.
« Last Edit: March 14, 2014, 02:47:19 am by qwerty »

Freddy_

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Automate creation of baseline
« Reply #2 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...

qwerty

  • EA Guru
  • *****
  • Posts: 13584
  • Karma: +396/-301
  • I'm no guru at all
    • View Profile
Re: Automate creation of baseline
« Reply #3 on: March 14, 2014, 09:59:34 pm »
I replaced the Format statement above with a simple string and then it worked.

q.

Freddy_

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
    • View Profile
Re: Automate creation of baseline
« Reply #4 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!