Article View: adobe.scripting.indesign
Article #1781Re: selecting text frames on multiple pages
From: Dave_Saunders
Date: Mon, 26 Jan 2009 21:30
Date: Mon, 26 Jan 2009 21:30
31 lines
1640 bytes
1640 bytes
A script cannot do things that are impossible in the UI. So, selecting on more than one page is not possible.
However, to do what you want, a script doesn't have to select anything.
//DESCRIPTION: move all text frames in document 12 units down
( function() {
if (app.documents.length > 0) {
moveTextFrames(app.documents[0], [0,12]);
}
function moveTextFrames(doc, offset) {
var spreads = doc.spreads.everyItem().getElements();
for (var j = spreads.length - 1; j >= 0; j--) {
spreads[j].textFrames.everyItem().move(undefined, offset);
}
}
}())
To move by some other amount, change the values (that's x and y in the units you're using) in the moveTextFrames call.
Interestingly, for this to work, you have to go a spread at a time. I expected that:
app.documents[0].textFrames.everyItem().move(undefined, [0,12]);
to work, but it didn't. Gave me the dreaded: this will cause an item to be moved off the pasteboard message.
Dave
Technical Details
Message-ID:
<59b7ad4b.0@webcrossing.la2eafNXanI>Path:
arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossingReferences:
<59b7ad4b.-1@webcrossing.la2eafNXanI>Show Full Headers
Complete Article Headers
X-Google-Thread: f939a,b6f8c90b1db063ab X-Google-Attributes: gidf939a,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit From: Dave_Saunders@adobeforums.com Path: arc1-ca.pugleaf.net!g2news2.google.com!news2.google.com!news.glorb.com!news2.glorb.com!newshub.sdsu.edu!webcrossing Newsgroups: adobe.scripting.indesign Subject: Re: selecting text frames on multiple pages Message-ID: <59b7ad4b.0@webcrossing.la2eafNXanI> Date: Mon, 26 Jan 2009 13:30:47 -0800 References: <59b7ad4b.-1@webcrossing.la2eafNXanI> Lines: 31 MIME-Version: 1.0 Content-Type: text/plain; charset="ISO-8859-1" Content-Transfer-Encoding: 8bit