Author Topic: EA-Matic EA_OnPostNewDiagramObject throws errors  (Read 771 times)

bkone

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
  • Is this real?
    • View Profile
EA-Matic EA_OnPostNewDiagramObject throws errors
« on: August 26, 2020, 06:57:51 pm »
Hello together,

I'm trying to use the EA-Matic to handle events when a new diagram object is created.
Unfortunately I do get an error when reading the object ID like this:
(I have looked up the correct parameter name on github)

function EA_OnPostNewDiagramObject(Info)
   dim diagramObjectID
   set diagramObjectID = Info.get("ObjectID")
end function

Any ideas what I'm doing wrong here?
Can someone point me to the correct attribute name?


Best regards

Boris

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11315
  • Karma: +422/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA-Matic EA_OnPostNewDiagramObject throws errors
« Reply #1 on: August 26, 2020, 07:31:37 pm »
Boris,

You don't have to guess (or search in Github) for the parameter names, they are documented in the manual

https://www.sparxsystems.com/enterprise_architect_user_guide/15.2/automation/ea_onpostnewdiagram.html

On there it says these are available:
Quote
Description: Contains these EventProperty objects for the new element:

ID: A long value corresponding to the ElementID of the object that has been added to the diagram
DiagramID: A long value corresponding to the DiagramID of the diagram to which the object has been added
DUID: A string value for the DUID; can be used with Diagram.GetDiagramObjectByID to retrieve the new DiagramObject

Geert

bkone

  • EA Novice
  • *
  • Posts: 19
  • Karma: +0/-0
  • Is this real?
    • View Profile
Re: EA-Matic EA_OnPostNewDiagramObject throws errors
« Reply #2 on: August 26, 2020, 10:47:10 pm »
Hello Geert,

ok, that I haven't tried. EA-Matic is then providing the events as they are from Enterprise Architect - understood.
I used the information from github code.

Thanks for the hint!
As a friend once said: As soon as you do it right it works!


Best regards

Boris

Geert Bellekens

  • EA Guru
  • *****
  • Posts: 11315
  • Karma: +422/-33
  • Make EA work for YOU!
    • View Profile
    • Enterprise Architect Consultant and Value Added Reseller
Re: EA-Matic EA_OnPostNewDiagramObject throws errors
« Reply #3 on: August 26, 2020, 11:53:06 pm »
Yes, indeed, EA-Matic merely passes the events and their parameters to the scripting environment.

Geert