Article View: adobe.scripting.indesign
Article #2113Re: [JS] :: [CSX] - PageItem Stacking Order
From: Peter Kahrel
Date: Sun, 04 Jan 2009 14:43
Date: Sun, 04 Jan 2009 14:43
23 lines
1419 bytes
1419 bytes
Ben,
What a great idea: duplicate pageItems and group the original and the duplicate so that all page items are of the same type. But you're making things very complicated. Your brilliant idea can be scripted simply as follows: on each page, duplicate each page item and group it with its original. Label the duplicates so that you can delete them easily later on:
doc = app.activeDocument;
for (i = 0; i < doc.pages.length; i++)
{
p_items = doc.pages[i].allPageItems;
for (j = 0; j < p_items.length; j++)
{
dupl = p_items[j].duplicate();
doc.pages[i].groups.add ([dupl, p_items[j]]);
}
}
Afterwards these two lines ungroup everything and delete the duplicates:
doc.groups.everyItem().ungroup();
doc.pageItems.item ('duplicate').remove()
Peter
Technical Details
Message-ID:
<59b767cf.3@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossingReferences:
<59b767cf.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,5dfad1e4d169194d X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: "Peter Kahrel" <kahrel@kahrel.plus.com> Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: [JS] :: [CSX] - PageItem Stacking Order Message-ID: <59b767cf.3@webcrossing.la2eafNXanI> Date: Sun, 4 Jan 2009 06:43:27 -0800 References: <59b767cf.-1@webcrossing.la2eafNXanI> Lines: 24 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit