I am currently working with InDesign CS2 files and i want to find all text frames and change its first baseline offset to "Cap Height". So I have tried the below syntax and it shows error. Please help me for this.

One important exception to this rule is with Text objects. With Text objects, I've found Collections to be more efficient than Arrays.

I think the reason for this is because Text objects don't really exist on the C++ level. Any time you access a Text object with scripting, InDesign must resolve that object within the whole text strand (which involves at least as much overhead as resolving the Collection). Page Items (and most other objects) on the other hand are basically mapped straight to the C++ ones so they don't need to be resolved in the same way.