All Manuals > COM/Automation User Guide and Reference Manual > 4 Automation Reference Entries

do-collection-items Macro

Summary

Iterates over the items of an Automation Collection.

Package

com

Signature

do-collection-items (item collection) form*

Arguments
item
A symbol bound to each item in the collection in turn.
collection
A form which is evaluated to yield a COM i-dispatch interface pointer that implements the collection protocol.
form
A form to be evaluated.
Description

The macro do-collection-items executes each form in turn, with item bound to each item of collection.

Note that for collections whose items are interface pointers, forms must arrange for each pointer to be released when no longer needed.

collection should be a COM interface pointer for an i-dispatch interface that implements the Collection protocol. The items are converted to Lisp as specified in 3.3.3 Data conversion when calling Automation methods.

Examples

For example, to iterate over the Table objects from the Tables collection of a MyDocument interface pointer:

(with-temp-interface (tables)
    (call-dispatch-get-property
       (doc my-document tables))
  (do-collection-items (table tables)
    (inspect-the-table table)
    (release table)))
See also

call-dispatch-method


COM/Automation User Guide and Reference Manual - 01 Dec 2021 19:38:41