Sparx Systems Forum
Enterprise Architect => Automation Interface, Add-Ins and Tools => Topic started by: DanielB on March 18, 2015, 01:47:21 pm
-
Hi,
Is it possible to open Element usage window from Script? Or something similar.
Regards,
Daniel
-
I don't think so, unless you play with SendKeys to simulate some kind of user interaction.
You could of course also write your own "element usage" window (in C# or similar) and display that using a script. But I guess you are trying to avoid any .Net development.
Geert
-
Thank you for qucik response.
I would like to avoid if it is possible. If not then I don't mind to put few lines of code in C#. Do you have a link to documentation which describes how to include C# libs in scripts?
-
In which scripts??
q.
-
Thank you for qucik response.
I would like to avoid if it is possible. If not then I don't mind to put few lines of code in C#. Do you have a link to documentation which describes how to include C# libs in scripts?
I don't really have a link, but I do have a few EA-Matic script examples (http://bellekens.com/ea-matic/) on my site where I use elements from my Enterprise Architect Addin Framework (https://github.com/GeertBellekens/Enterprise-Architect-Add-in-Framework)
Another example is the usage of a .net ArrayList below in the vbscript function below
function getOrderedActivities(diagram)
'loop all diagram object
dim diagramObject as EA.DiagramObject
dim orderedActivities
dim orderedDiagramObjects
set orderedActivities = CreateObject("System.Collections.ArrayList")
set orderedDiagramObjects = CreateObject("System.Collections.ArrayList")
for each diagramObject in diagram.DiagramObjects
dim element as EA.Element
set element = Repository.GetElementByID(diagramObject.ElementID)
if not element is nothing and element.Type = "Activity" then
dim added
added = false
dim i
for i = 0 to orderedDiagramObjects.Count - 1
if diagramObject.top = orderedDiagramObjects(i).top then
'height is equal, check x position
if diagramObject.left <= orderedDiagramObjects(i).left then
orderedDiagramObjects.Insert i, diagramObject
orderedActivities.Insert i, element
added = true
exit for
end if
elseif diagramObject.top > orderedDiagramObjects(i).top then
'add before
orderedDiagramObjects.Insert i, diagramObject
orderedActivities.Insert i, element
added = true
exit for
end if
next
'if not added yet then add it to the back of the list
if not added then
orderedDiagramObjects.Add diagramObject
orderedActivities.Add element
end if
end if
next
set getOrderedActivities = orderedActivities
end function
Geert