Article View: adobe.scripting.indesign
Article #780Re: extract items from a frame
From: Peter Kahrel
Date: Tue, 03 Mar 2009 10:31
Date: Tue, 03 Mar 2009 10:31
43 lines
1698 bytes
1698 bytes
Groan. This line:
myFrames[j].parent.constructor.name = 'Character'
should be
myFrames[j].parent.constructor.name == 'Character'
That's what you get when you add lines at the last moment and don't try it. I added that line because when a frame is already "independen", its parent is a page, whereas an embedded frame's parent is a character.
That all styling is lost surprises me, but that is indeed the case. That calls for a different approach:
#target indesign;
myPages = app.activeDocument.pages;
for (i = 0; i < myPages.length; i++)
{
myFrames = myPages[i].allPageItems;
for (j = myFrames.length-1; j > -1; j--)
{
if (myFrames[j].parent.constructor.name == 'Character')
{
try
{
gb = myFrames[j].geometricBounds;
myFrames[j].duplicate ([gb[1],gb[0]]);
myFrames[j].remove();
}
catch(_){}
}
}
}
This leaves all formatting intact. The script should really also check if myFrames[n] is a text frame.
Peter
Technical Details
Message-ID:
<59b81716.8@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b81716.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,50e6c9aacf044ae5 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!g2news1.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: extract items from a frame Message-ID: <59b81716.8@webcrossing.la2eafNXanI> Date: Tue, 3 Mar 2009 02:31:02 -0800 References: <59b81716.-1@webcrossing.la2eafNXanI> Lines: 40 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit