🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #19784

Re: VB6&ID - Replace function like ImportXML

#19784
From: Olav Kvern
Date: Thu, 21 Nov 2002 23:37
23 lines
3385 bytes
David-- 

Let's start with the last item first--Groups do not have a ContentType property, even though they're PageItems. We try to suppress properties that make no sense--even if they're inherited. So, yes, Group inherits most PageItem properties, and appears in the PageItems collection, but it does not inherit properties that could not be set using the user interface. If you're ever in doubt about whether a property is suppressed for a given object (StrokeWeight, for example, on an Image object), check the Object Browser for that specific object, not for PageItem. 

Next, it's true--a TextFrame does not have a TextFrames collection. The text objects(ParentStory) contained in the TextFrame *do* have a TextFrames collection, on the other hand, so you can get to it that way. 

But I'm not sure why you're asking a TextFrame for its TextFrames, and realize that I wrote my example in too much haste--especially for your intended use. 

You probably don't want to use AllPageItems if you're scanning object lists to do your own XML export (something that I do, by the way, probably for the same reasons you want to). AllPageItems returns *all* of the page items in a given object, regardless of their position in the object hierarchy--Document.AllPageItems, for example, returns all of the page items on all document pages. 

This differs from the PageItems collection of an object, which returns only the *top level* items in that object. If items are nested inside other objects--e.g., an image in a graphic frame, a text frame in a group, etc.--they won't appear in the PageItems collection for the page, spread, or document. If you're writing XML, I would think that you would want to retain the hierarchy. 

For Each...Next constructions do not iterate through all of the items in a collection because doing so would crash the VB locals and watch windows when you had a collection of more than 256 items. This causes other problems, but it's by design. 

It seems to me that I should rework the PageItems reference in the Scripting Guide, as it's causing misunderstandings. I should probably suppress properties in PageItem that are not shared by *all* PageItems. 

It's very useful to be able to work with PageItems collections, but you cannot assume that all items qualifying as PageItems have the same sets of attributes. Again, using TypeName in a Select Case block to funnel objects to the appropriate script responses is probably the best way to work with PageItems collections. 

I'm hoping that this makes more sense now? 

Thanks, 

Ole
Technical Details
Message-ID: <1de6b092.7@WebX.la2eafNXanI>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newspump.sol.net!news-out.cwix.com!newsfeed.cwix.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
References: <1de6b092.-1@WebX.la2eafNXanI>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f939a,9fb81744ad733cf6
X-Google-Attributes: gidf939a,public
X-Google-ArrivalTime: 2002-11-21 15:37:41 PST
From: "Olav Kvern" <okvern@adobe.com>
Path: arc1-ca.pugleaf.net!archiver1.google.com!news1.google.com!sn-xit-02!sn-xit-05!sn-xit-03!sn-xit-01!sn-xit-08!supernews.com!newspump.sol.net!news-out.cwix.com!newsfeed.cwix.com!news.tele.dk!news.tele.dk!small.news.tele.dk!eusc.inter.net!newsfeed01.sul.t-online.de!t-online.de!WebX
Newsgroups: adobe.scripting.indesign
Subject: Re: VB6&ID - Replace function like ImportXML
Message-ID: <1de6b092.7@WebX.la2eafNXanI>
Date: Thu, 21 Nov 2002 15:37:01 -0800
References: <1de6b092.-1@WebX.la2eafNXanI>
Lines: 53
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit