You must be logged in to post Login

Search Forums:


 






Pasting on multiple pages?

UserPost

3:02 am
February 2, 2012


Mathieu Christe

Community Member

posts 17

When I was working with Quark XPress, I used to have an extension allowing for pasting on multiple pages. I looked in the Help and did a quick search online but couldn't find a solution for that in InDesign.

Ideally, I'd like to be able to select a few objects, that might not be on the same layer, select a range of pages, and be able to paste these objects on those pages all at once.

Do you know if this is possible? If not, is there a script for that?

Thanks for your help, with my best regards,

Mathieu

5:43 am
February 2, 2012


Eugene Tyson

Member

posts 653

The only way I can think of is to duplicate your master page


Put the images on the page in the location required and layers required.


Then select those pages via the Pages Panel – then use the Apply Master Pages, and select the duplicate master page.


Then all those images would appear on those pages.

But other than that I think you'd need a script.

"Ingenious, isn't it, Mr. Bunt? "

8:38 am
February 2, 2012


Jongware

Member

posts 763

Post edited 8:43 am – February 2, 2012 by Jongware
Post edited 8:47 am – February 2, 2012 by Jongware


The copying-and-pasting bits are scriptable, but unfortunately the scripting interface doesn't allow access to your 'selected range of pages' in the Pages panel. (If this happens to get added in CS6, it'd be a welcome addition … I could think of a few useful things to do with it!)


Oh sure you can use Master pages (in fact, do you have reasons not to?), but I've had some fun writing this quick Javascript. It uses logical page numbers, unencumbered by stuff like roman numeral preambles and separe sections, so take care to enter the right ones.

//DESCRIPTION: Multi Copy to Multi Pages
// A Jongware script, 2-Feb-2012
// Make sure there is something appropriate selected
if (app.documents.length > 0 && app.selection.length > 0 && !(app.selection[0].hasOwnProperty("baseline")))
{
if (parseFloat(app.version) < 6)
multiCopy (app.selection);
else
app.doScript(multiCopy, ScriptLanguage.JAVASCRIPT, app.selection, UndoModes.ENTIRE_SCRIPT, "Multi Copy to Multi Pages");
} else
{
alert ("No valid selection.\nPlease select one single object with the black arrow before running this script.");
}

function multiCopy (sel)
{
originalPage = app.layoutWindows[0].activePage.documentOffset;
pagerange = prompt ("Apply to page range (logical page numbers):", String(originalPage+1)+"-"+String(app.activeDocument.pages.length));
if (pagerange != null)
{
pagerange_nrs = pagerange.match(/^(\d+)-(\d+)$/);
if (pagerange_nrs.length == 3)
{
// ID pages start counting at 0, so subtract 1:
startpg = Number(pagerange_nrs[1])-1;
if (startpg < 0)
{
alert ("Surely you are joking? You can't start at page 0!");
return;
}
endpg = Number(pagerange_nrs[2]);
if (endpg >= app.activeDocument.pages.length)
{
alert ("Surely you are joking? You can't continue after the last page!");
return;
}
// Subtracting 1 not necessary for the end page
// (that's due to JavaScript for..loop behavior)
for (i=startpg; i<endpg; i++)
{
if (i != originalPage)
{
for (j=0; j<sel.length; j++)
sel[j].duplicate (app.activeDocument.pages[i]);
}
}
} else
alert ('Bad page range. Please use "from-to" syntax using logical page numbering.');
}
}

(Edit: next time watch out for possible post enhancements..)

(Edit II: 3rd time lucky?)

8:49 am
February 2, 2012


Jongware

Member

posts 763

I spotted a tiny tiny error –

if (endpg >= app.activeDocument.pages.length)

in line 32 should read

if (endpg > app.activeDocument.pages.length)

but I dare not enter the Editor again … (As it is, this script now fails if you attempt to copy stuff all the way up to the very last page.)

11:26 am
February 2, 2012


Mathieu Christe

Community Member

posts 17

Time flies, I was shaping bezier curves of a new typeface the whole afternoon and suddenly noticed some answers to my post.


Dear Eugene,

Thank you for your idea, I haven't thought about it, that's clever.


Dear Jongware,

Many thanks for that script, it does the trick just as I was expecting the magic to operate!


Best regards, M

6:56 am
February 3, 2012


Eugene Tyson

Member

posts 653

Mine might have been clever, but Jongware possesses the genius scripting brain that I lack.

"Ingenious, isn't it, Mr. Bunt? "