コレクション内の項目数を表す Long を戻します。
// get accessor Int32 rtn = XSICollection.Count; |
Dim oColl ' object pointer for collection Dim i ' counter to use in the loop ' Create the collection as an ActiveX object Set oColl = CreateObject("XSI.Collection") ' Add some items to it oColl.Add "Camera" oColl.Add "Light" ' Use the number of items to loop through the collection ' (use Count - 1 because the index starts at 0, not one) For i = 0 to oColl.Count - 1 LogMessage "Hi! My name is " & oColl(i).Name & _ " and I am at index " & i & " in the collection." Next '-------------------------------------------------- ' Output of above script: 'INFO : "Hi! My name is Camera and I am at index 0 in the collection." 'INFO : "Hi! My name is light and I am at index 1 in the collection." |