Forum Discussion
alinder
15 years agoContributor
Thank you for the idea, Robert. The approach has some very tempting results.
The problem is that your approach seems to crawl through the aliases of objects currently displayed in the tested application, not the entire alias tree.
I did find that you can crudely do the same sort of thing using the GetProperties method and filtering out any property you find that isn't another Alias or Name Mapping item. Code below; I started with something that threw out specific property names, like "Exists","NamedChild","NamedChildCount", or "NodeDescription", but later found that using the below which keys off of ValueType seemed to work for my project.
The problem is that your approach seems to crawl through the aliases of objects currently displayed in the tested application, not the entire alias tree.
I did find that you can crudely do the same sort of thing using the GetProperties method and filtering out any property you find that isn't another Alias or Name Mapping item. Code below; I started with something that threw out specific property names, like "Exists","NamedChild","NamedChildCount", or "NodeDescription", but later found that using the below which keys off of ValueType seemed to work for my project.
Sub GetNextAlias(AliasObject)
Dim iteratorProperties
Dim iteratorProp
Set iteratorProperties = aqObject.GetProperties(AliasObject)
While iteratorProperties.HasNext
Set iteratorProp = iteratorProperties.Next
'ValueType 29 appears to correspond with other objects from the name mapping or alias trees
If (iteratorProp.ValueType = 29) Then
Log.AppendFolder(iteratorProp.Name)
GetNextAlias(aqObject.GetPropertyValue(AliasObject,iteratorProp.Name))
Log.PopLogFolder
End If
Wend
End Sub
Sub test()
Log.AppendFolder("Name Mapping")
Call GetNextAlias(NameMapping.Sys)
Log.PopLogFolder
Log.AppendFolder("Aliases")
Call GetNextAlias(Aliases)
Log.PopLogFolder
End Sub