I am struggling to make sense of the VBScript API to Enterprise Architect.
I want to add an artefact if and only if it has not already been added, its a large import so I want to use the GetElementsByQuery interface to check if class or interface has already been created and then use the existing reference rather than a new one.
the following code throws an exception every time, even when I know strSourceName is already added to the repository.
on error resume next ' in case no object found the query will throw an exception
objCollection = Ea.Repository.GetElementsByQuery( "Simple", "strSourceName" )
If Err.Number = 0 Then
Session.Output( "info: found :" & strSourceName & ":" )
Else
Session.Output( "warn: not found :" & strSourceName & ":" )
Err.Clear
End If
I am not familiar with either EA or VBScript so please go easy on me.
Thanks in advance for any help.