Skip to main content
Participant
January 26, 2009
Question

selecting text frames on multiple pages

  • January 26, 2009
  • 3 replies
  • 1185 views
hello all -

i have a problem i believe is tailor-made for a script, but i don't know enough about scripting to tackle it. in CS3, i have a 300+ page document and i wish to select all text frames and change their Y position. is there a script that exists for this? the "select objects" script in indesign sadly doesn't select across multiple pages.

thanks!
micah
This topic has been closed for replies.

3 replies

Loic.Aigon
Legend
January 26, 2009
Oh Dave has already been by here and already corrected me :-)
b spreads.textFrames.everyItem().move(undefined, offset);
i I tried [undefined,2] but it seems you cannot avoid move only one axis only.
Loic.Aigon
Legend
January 26, 2009
you cannot select all textframes at once as you can't do in the UI.<br />however you can create a collection of textframes and loop thought it to move the positions.<br />var mytf = app.activeDocument.textFrames.everyItem().getElements();<br />for(i=0; i<mytf.length; i++)<br />{<br /> var x = mytf.geometricBounds[1];<br /> var y = 2 //for example;<br /> mytf.move([x,y]);<br />}<br />I tried [undefined,2] but it seems you cannot avoid move only one axis only.<br /><br />Loic
Inspiring
January 26, 2009
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.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]);

would work, but it didn't. Gave me the dreaded: this will cause an item to be moved off the pasteboard message.

Dave