Highlighted

Copying and pasting in different pages

Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

Hello! I'm trying to copy and paste either selected objects/groups or a layer into 5 subsequent pages right from page 1. It's going to be repeated over 600 times if I have to do it manually...... Is there any way/scripts for this? Please help! Thank you so much.

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

Are all the text frames you want to copy on the same, unique layer? You mentioned layers earlier. 

Do you need to create the 5 subsequent pages, or do they already exist? 

No existing script exists that solves your unique case, but something custom could probably be developed. 

 

Rudimentarily speaking, you could do something like this if the target pages already exist. Note that the offset of the duplicated frames would be off if you are working with facing pages and have a wider outer margin than inner margin. Also, the try block would fail if the selected item is not duplicable (ie a highlighted text selection) 

 

 

 

var select = app.selection;
var doc = app.activeDocument;
for (var i = 0; i < select.length; i++) {
    try {
        var currPageIdx = select[i].parentPage.documentOffset;
        var bounds = select[i].geometricBounds;
        for (var j = 1; j <= 5; j++) {
            currPage = doc.pages[currPageIdx + j];
            select[i].duplicate(currPage);
        }
    }
    catch(e) {}
}

 

 

 

If all the desired page items to copy are on their own layer, you could sub the select variable for this: 
var select = app.activeDoucment.layers.itemByName("The Layer In Question").allPageItems;

Topics

How to, Import and export, Scripting

Views

849

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Copying and pasting in different pages

Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

Hello! I'm trying to copy and paste either selected objects/groups or a layer into 5 subsequent pages right from page 1. It's going to be repeated over 600 times if I have to do it manually...... Is there any way/scripts for this? Please help! Thank you so much.

Adobe Community Professional
Correct answer by brianp311 | Adobe Community Professional

Are all the text frames you want to copy on the same, unique layer? You mentioned layers earlier. 

Do you need to create the 5 subsequent pages, or do they already exist? 

No existing script exists that solves your unique case, but something custom could probably be developed. 

 

Rudimentarily speaking, you could do something like this if the target pages already exist. Note that the offset of the duplicated frames would be off if you are working with facing pages and have a wider outer margin than inner margin. Also, the try block would fail if the selected item is not duplicable (ie a highlighted text selection) 

 

 

 

var select = app.selection;
var doc = app.activeDocument;
for (var i = 0; i < select.length; i++) {
    try {
        var currPageIdx = select[i].parentPage.documentOffset;
        var bounds = select[i].geometricBounds;
        for (var j = 1; j <= 5; j++) {
            currPage = doc.pages[currPageIdx + j];
            select[i].duplicate(currPage);
        }
    }
    catch(e) {}
}

 

 

 

If all the desired page items to copy are on their own layer, you could sub the select variable for this: 
var select = app.activeDoucment.layers.itemByName("The Layer In Question").allPageItems;

Topics

How to, Import and export, Scripting

Views

850

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Adobe Community Professional ,
Jun 02, 2020

Copy link to clipboard

Copied

Don't use Copy and Paste, use Place and then use the Microsoft Word Import facility, where you can map Word paragraph and character styles to your InDesign styles. This YouTube tutorial shows you how (how map styles starts about 11 minutes in):

https://m.youtube.com/watch?v=0guCSyq-Avs

I suggest you experiment first with a couple of test documents to get the hang of it. There's a lot on this kind of workflow, if you have to do it regularly there's a whole tutorial on it by AM on Linkedin Learning (you can get 30-days free access): https://www.linkedin.com/learning/word-and-indesign-integration?trk=learning-serp_learning_search-ca...

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Jun 02, 2020

Copy link to clipboard

Copied

Thank you for your reply, Derek! I'm actually having to copy hyperlinked text frames within the spread and paste in place into the next few pages. So importing MS Word wouldn't apply here......

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jun 03, 2020

Copy link to clipboard

Copied

Could you be more detailed, please. hyperlinked (not just threaded) text frames. The source hyperlink text frame and the destination frame? Those frames will be pasted in place in the next five pages. And is it repeated sequentially anyhow, 600 times? And in the same document? How many pages will it have?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Jun 03, 2020

Copy link to clipboard

Copied

It's about 800-900 pages which are hyperlinked within the document. So the destination is just the pages within the document. The threaded text frames have hyperlinked text within them, and I'm trying to copy a group of text frames from page, say, 1 to the subsequent 5 pages. And then copy the frames from page 6 and paste in place into the next 5 pages, and rinse and repeat. Would this be possible without changing the applied master pages? Thank you so much!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jun 03, 2020

Copy link to clipboard

Copied

Excuse me but it takes me a lot of time understand what are you doing, creatring hyperlinks in threaded text on the same page? and then duplicating it (the text) in the next five pages, what is the purpose that I can hardly imagine. Could you please attach an example, mock-up, or a picture with some explanations, an explain representation of how it is made, used, and the goal of it? The Master pages would have to have different contents.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jun 03, 2020

Copy link to clipboard

Copied

Are all the text frames you want to copy on the same, unique layer? You mentioned layers earlier. 

Do you need to create the 5 subsequent pages, or do they already exist? 

No existing script exists that solves your unique case, but something custom could probably be developed. 

 

Rudimentarily speaking, you could do something like this if the target pages already exist. Note that the offset of the duplicated frames would be off if you are working with facing pages and have a wider outer margin than inner margin. Also, the try block would fail if the selected item is not duplicable (ie a highlighted text selection) 

 

 

 

var select = app.selection;
var doc = app.activeDocument;
for (var i = 0; i < select.length; i++) {
    try {
        var currPageIdx = select[i].parentPage.documentOffset;
        var bounds = select[i].geometricBounds;
        for (var j = 1; j <= 5; j++) {
            currPage = doc.pages[currPageIdx + j];
            select[i].duplicate(currPage);
        }
    }
    catch(e) {}
}

 

 

 

If all the desired page items to copy are on their own layer, you could sub the select variable for this: 
var select = app.activeDoucment.layers.itemByName("The Layer In Question").allPageItems;

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Community Beginner ,
Jun 03, 2020

Copy link to clipboard

Copied

@federico_platon, I’m sorry about the confusion. I’m in a project of making an ebook with extensive hyperlinks throughout the document, so there has been a lot of manual work already. A number of master pages are applied to spreads already which have the same layouts but with different text frames with different hyperlinked text in each page. So for every 36 pages they’ll have the same master pages applied but the hyperlinks are different after the initial 6 pages with different elements which have separate hyperlinks on top of them - I don’t know if this makes sense at all. 😅

 

As for the script from @brianp311, this is perfect!!! That’s exactly what I was looking for. You just saved me hours of work! I don’t know how to thank you enough. Thank you so much!!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Adobe Community Professional ,
Jun 03, 2020

Copy link to clipboard

Copied

Glad it worked. Also note the try would fail for any items in the pasteboard, and the "bounds" variable line is unnecessary (I was testing the margin issue when I included it). 

As far as the work/time saved is concerned, if you feel so inclined, please feel free to make a donation to a nonprofit working to address the current crises (COVID-19 or racial equity). 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...