Skip to main content
Participating Frequently
November 13, 2019
Answered

Pasting into multiple layers

  • November 13, 2019
  • 6 replies
  • 8668 views

Hi

Does anyone know if its possible to paste the same thing into multiple layers with one click in Illustrator? I'm aware of the 'paste on all artboards' option, however thats not an option for me. I'm working in layers of more than 100 + and at the moment the only way of duplicating the same thing onto all layers is to tediously copy and paste in front on every layer, any solutions would be much appreciated.

 

thanks

nick

Correct answer CarlosCanto

Hi nick, try this script. Select the text in the top-most layer, the script will copy it to all other layers except the first one.

 

 

// copy selected object to all layers
// carlos canto
// https://community.adobe.com/t5/Illustrator/Pasting-into-multiple-layers/td-p/10735655

var idoc = app.activeDocument;
var sel = idoc.selection[0];

for (var a=1; a<idoc.layers.length; a++) {
    sel.duplicate(idoc.layers[a], ElementPlacement.PLACEATBEGINNING);
}

 

6 replies

Participant
February 13, 2023

Hi Nick,

 

Yep it's possible. All you have to do is highlight all the layer in your layers window then PASTE IN PLACE. That should paste the object or text into all layers. I find it's a good idea to first paste on top layer get it in the right place then paste in place onto the rest. Hope that helps!

Participant
February 13, 2023

Sorry - scratch that. I thought it worked but was just a delayed fail as the layers were slow to load. (face palm)

Participant
September 6, 2021

Hi, should the script work in CS5?

 

tnx

CarlosCanto
Community Expert
Community Expert
September 6, 2021

Hi, yes.

CarlosCanto
Community Expert
CarlosCantoCommunity ExpertCorrect answer
Community Expert
November 13, 2019

Hi nick, try this script. Select the text in the top-most layer, the script will copy it to all other layers except the first one.

 

 

// copy selected object to all layers
// carlos canto
// https://community.adobe.com/t5/Illustrator/Pasting-into-multiple-layers/td-p/10735655

var idoc = app.activeDocument;
var sel = idoc.selection[0];

for (var a=1; a<idoc.layers.length; a++) {
    sel.duplicate(idoc.layers[a], ElementPlacement.PLACEATBEGINNING);
}

 

Emac_trademark
Inspiring
March 23, 2022

Hi Carlos,

It seems that this script only copies the TOP MOST object SELECTED in a given layer even if you have multiple objects selected.  Any chance you could modify it so it copies everything selected to the rest of the layers?  Or tell me what to modify?  Even better would be if it copied everything selected from ANY layer and pasted into all the other layers except the source layer(s).

 

Either way, this script is super helpful, thank you!

Participant
December 2, 2023

I wrote a script for that in 2013, I couldn't find the post but here's a copy of the script

 

//  copySelectionToAllLayers.jsx;   // carlos canto // 07/06/13
//  http://forums.adobe.com/message/5481849?tstart=0#5481849

//#target Illustrator

var idoc = app.activeDocument;
selec = idoc.selection;
if (selec.length>0) {
	
	var layers = idoc.layers;
    var layercount = layers.length;
	for (j=0; j<selec.length; j++) {
        var obj = selec[j];
        for(i=0; i<layercount; i++) {
            var ilayer = layers[i];
            var sel = obj.duplicate(ilayer,ElementPlacement.PLACEATEND)
        }
        obj.remove();
	} 
}
else {
	alert("select something before running");
}

Hi Carlos,

I think the second script you provided in this thread (to Emac_trademark) would almost work for something I am trying to automate.

 

I have multiple files with 125 layers, and I wish to paste (in place) a selection of objects onto the top 25 layers, and then a different selection of objects to the next 25 layers, and so on. So, I have five unique groups of objects to select and paste into 25 layers each. I have been doing it one layer at a time...

 

Could the script be edited to only paste into the 24 or 25 layers below the selected object. And would it only paste what is selected from the top layer or the entire contents of the layer? (I am hoping to only have it pasted what I have selected or selected and copied to clipboard.

 

Thanks!

Legend
November 13, 2019

"1 have a 100 or so files to do with some that have upwards of 250 layers, being able to potentially click once and have it pasted in front of all layers will save me an incredible amount of time, plus this is not the only instance where i have to do further pasting into all layers later on, seems incredible that illustrator does not have this as an option to me...."

 

It sounds like only one layer at a time will be visable for each output instance. If that is the case, using Variable Data might just save you a ton of time.

rcraighead
Legend
November 13, 2019

Yes, or a script.

John Mensinger
Community Expert
Community Expert
November 13, 2019

What you want doesn't exist as a feature, presumably because having the same element(s), at the same coordinates, on 100+ layers is not an intended workflow. Having that content visible on one layer is all that's needed for it to appear on the artboard in a typical scenario. I realize there may be exceptions like cumulative animation sequences and such, but there are other ways to go about that rather than an after-the-fact paste. So specifically, why do you need that one thing on all layers?

Participating Frequently
November 13, 2019

each layer needs a different text annotation added in the same place using a basic framework, so as opposed to the very long way of individually writing full text on , i am copying and pasting on every layer a generic text and then editing a small portion of this on every layer, this then identifies each layer which i need to do before i can proceed any further. these artworks come to already in layers and there is no other option to have them presented another way. (its for screen printing btw)

 

John Mensinger
Community Expert
Community Expert
November 13, 2019

 

". . . pasting on every layer a generic text and then editing a small portion of this on every layer . . ."

 

Hmmm, so if you have to visit each layer one-by-one to make that edit anyway, why is it a problem to just tap Ctrl/Cmd+F to paste in front before making the edit? What am I missing?

Larry G. Schneider
Community Expert
Community Expert
November 13, 2019

Check in the flyout menu of the Layers panel (upper right) and make sure that Paste Remembers Layers is checked.

Participating Frequently
November 13, 2019

thanks for reply, i have looked at that option and that just allows you to copy and paste from one file to the next keeping it as layers rather than flattening it, however it doesnt allow you to paste into multiple layers at a time, even with that checked and all layers selected i can only paste into 1 layer still?