pankaj.c Counting textframes with same label on page (IDCS3)
Jun 28, 2010; 01:30
pankaj.c
Counting textframes with same label on page (IDCS3)
Hello all,
Is there a way to count no of textframes on a page having same label in one go.
All I am trying is below:
var myDoc=app.activeDocument; var myTotalPage = myDoc.pages.length; for (var i=0; i<=myTotalPage-1; i++) { var sect_frames=0; var totalTextFrames = myDoc.pages[i].textFrames.length;
//Now look for the textFrames with label "sections"s for (var t=0;t<totalTextFrames;t++) { //check for labels var Text_FRAME = myDoc.pages[i].textFrames[t]; var frame_label = Text_FRAME.label; if(frame_label=="sections") { sect_frames++; } } $.writeln ("Total number of sections frames on :"+myDoc.pages[i].name+ " are: "+sect_frames);
}
This gives me the correct no of textframes with "sections" label on page but I need on the fly to check if the "sect_frame" count is greater than 1 get the geometric bounds of each labeled frame and compare them. I do not require to do anything if the count of labeled frame is one.
May be something like
if(sect_frames>1) { // Do something here. } } if I do
//check for labels var Text_FRAME = myDoc.pages[i].textFrames[t]; var frame_label = Text_FRAME.label; if(frame_label=="sections") { sect_frames++; $.writeln("GB of frame on page "+myDoc.pages[i].name+" is : "+myDoc.pages[i].textFrames[t].geometricBounds+"\n"); }
It gives the GB of textframe whose occurrence is 1 on a page and not desirable.
I tried something below, which selects the correct no of frames but I am not able to find the selection count.
var totalSectFrames = myDoc.pages[i].textFrames.item("sections").select();
Thanks, --PC
-- This list is a free service of LassoSoft: http://www.LassoSoft.com/ Search the list archives: http://www.ListSearch.com/InDesign/Browse/ Manage your subscription: http://www.ListSearch.com/InDesign/
Jun 28
pankaj.c Re: Counting textframes with same label on page (IDCS3)
Jun 28, 2010; 03:13
pankaj.c
Re: Counting textframes with same label on page (IDCS3)
Search
Lasso Programming
This site manages and broadcasts several email lists pertaining to Lasso Programming and technologies related and used by Lasso developers. Sign up today!