🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: adobe.scripting.indesign
Article #614

CS3 Get ObjectType of pageItem

#614
From: asci
Date: Tue, 10 Mar 2009 11:36
22 lines
1271 bytes
Hello,

When getting pageitems from a page i have some problems to get their type (e.g. Group, TextFrame). I have found a solution but i do not know if i can get some trouble with using getElements():

var curDoc = app.activeDocument;
var curPage = curDoc.pages[0];
var pageItems = curPage.pageItems;

for(var i=0; i<pageItems.length; i++) {

var curBox = pageItems[i];
   var element = curBox.getElements();

if(element.length > 0) {
      var groupItems = element[0];
      alert(groupItems.constructor.name);
   }
}

Is there any better solution to get the type of a pageItem? In my case <element> has only one element and i do not know if there is a case where there could be more elements in the array.

Thank you, asci
Technical Details
Message-ID: <59b82b97.-1@webcrossing.la2eafNXanI>
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing

Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,b4ebaf76a649e74b,start
X-Google-Attributes: gidf939a,domainid0,public,usenet
X-Google-Language: ENGLISH,ASCII-7-bit
From: asci@adobeforums.com
Path: arc1-ca.pugleaf.net!g2news2.google.com!news1.google.com!newshub.sdsu.edu!webcrossing
Newsgroups: adobe.scripting.indesign
Subject: CS3 Get ObjectType of pageItem
Message-ID: <59b82b97.-1@webcrossing.la2eafNXanI>
Date: Tue, 10 Mar 2009 04:36:24 -0700
Lines: 26
MIME-Version: 1.0
Content-Type: text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding: 8bit