XSICollection.AddItems

Description

Adds one or more items to the collection. Compare this method to XSICollection.Add, which only adds a single item at a time or XSICollection.SetAsText, which adds all items in the string list.

Scripting Syntax

XSICollection.AddItems( Items );

Parameters

Parameter Type Description
Items XSICollection, Array or object name The items to add.

Examples

VBScript Example

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"

See Also

XSICollection.GetAsText XSICollection.Add XSICollection.RemoveItems