Dim oColl ' object pointer for collection
Dim aItems ' array of items to add all at once
' Create the new collection & populate it using SetAsText
Set oColl = CreateObject( "XSI.Collection" )
oColl.SetAsText "Camera,Light"
checkContents oColl
' Clear it and add the items again using Add
oColl.RemoveAll
checkContents oColl
oColl.Add "light"
oColl.Add "camera"
checkContents oColl
' Clear it again and add the items using AddItems
oColl.RemoveAll
aItems = Array( "Camera", "Light" )
oColl.AddItems aItems
checkContents oColl
'--------------------------------------------------
function checkContents( in_coll )
LogMessage "----------------"
If in_coll.Count > 0 Then
LogMessage "Collection now contains " & in_coll.GetAsText
Else
LogMessage "Collection is empty."
End If
end function
'--------------------------------------------------
' Output of above script:
'INFO : "----------------"
'INFO : "Collection now contains Camera,light"
'INFO : "----------------"
'INFO : "Collection is empty."
'INFO : "----------------"
'INFO : "Collection now contains light,Camera"
'INFO : "----------------"
'INFO : "Collection now contains Camera,light" |