Hi Silvain,
The script you are starting from uses the EAAddinframework as you noticed.
So that means you are no longer programming against the EA API, but against the library of wrappers I wrote.
The
relatedElement you get as a parameter is coming from
connector.relatedElements, which returns hashmap of
UML.Classes.Kernel.Element (see
ConnectorWrapper)
The
Element interface does not define a property
Stereotype but it does have a property called
stereotypes, a hashmap of
Stereotypes. So before using that in VBScript you'll have to convert that to an ArrayList like we did with the RelatedElements (generics cannot be used in VBScript)
Then you can iterate the list of stereotypes and check the .name property.
Alternatively you can rely on the properties and operations of the
Element class, which is the parent class of almost all classes in the EAAddin framework.
That class defines an operation to test for a specific stereotype:
bool HasStereotype(string stereotype)and also a list of stereotype names
List<string> stereotypeNames which you have to convert to an ArrayList again before being able to use it.
Hmm, explaining it like that makes it look very complicated doesn't it

I didn't really intend the library for usage in scripts. It is just a side effect of installing the EA Toolpack. The library is much richer then the standard EA API, and often allows you to write denser and more functional code. But it also has somewhat of a learning curve I guess.
Geert
PS. You don't
have to use the EAAddinLibrary when writing EA-Matic scripts. You can also simply use the raw EA API.