Hi,
make a browser script and you have the specification at the right mouse.
option explicit
!INC Local Scripts.EAConstants-VBScript
' ---------------------------------------------------------------
' Show specification
' ---------------------------------------------------------------
' Browser, Diagram, Model Search
' ---------------------------------------------------------------
' Display files\web addresses according to the file property of an element (instance, class, port,..).
' If the classifier has a type it also outputs the type of the classfier.
' ---------------------------------------------------------------
' 13.02.2013 Created
'
' Diagram Script main function
'
sub OnDiagramScript()
dim selectedElement as EA.Element ' to use intelli sense for Element
dim classifier As EA.Element ' to use intelli sense for Element
dim el As EA.Element
dim file As EA.File
dim filename
dim err
dim id
dim guid
' Get context element
Set selectedElement = Repository.GetContextObject()
dim objShell
Set objShell = CreateObject( "WScript.Shell" )
' Element selected
if not selectedElement is nothing AND selectedElement.ObjectType = otElement then
display(selectedElement) ' Display all files of element
end if
' Element Type = Package (don't works, because package don't support .Files)
'if not selectedElement is nothing AND selectedElement.ObjectType = otPackage then
' display(selectedElement) ' Display all files of element
'end if
if not selectedElement is nothing AND selectedElement.ObjectType = otElement then
' if type exists check this type also for embedded elements (Instance, Object, Port)
id = selectedElement.ClassfierID
if id > 0 then
set classifier = Repository.GetElementByID(id)
display(classifier) ' Display all files of element
end if
' if type exists check this type also (Instance, Object, Port)
guid = selectedElement.MiscData(0)
if Len(guid) = 38 then
set classifier = Repository.GetElementByGuid(guid)
display(classifier) ' Display all files of element
end If
end if
end sub
'----------------------------------------------------------------
' display the files of the classifier
'----------------------------------------------------------------
sub display(classifier)
dim file As EA.File
dim objShell
dim filename
Set objShell = CreateObject( "WScript.Shell" )
for each file in classifier.Files
filename = """" & file.Name & """"
err = objShell.run( filename,1,false )
if err <> 0 then
Session.Output "Filename:" & filename & " " & err
End If
next
Set objShell = Nothing
end sub
OnDiagramScript
Helmut