Copy link to clipboard
Copied
Does anyone know of a way to select multiple items in one inDesign layer, and paste them into multiple other layers, at once, wihout having to copy and paste to each layer? I work with a lot of versioning, and copy and pasting the same items countless times gets very time consuming and tedious.
There is no way around this work flow, which is why I have come here for help.
Copy link to clipboard
Copied
Hmm, someone may be able to come up with a partial solution via a scripted "release-to-layers" style result, but as far as I know, there are no native features aimed at accommodating the workflow you describe.
Am I correct, then, in assuming you're building multiple versions all in one file? It could also be an assumption on my partāor something I've failed to infer about your particular workflowābut I should think most "versioning" is done using multiple files, as opposed to stacking up additional layers in a single file.
Copy link to clipboard
Copied
That is correct. The versioning is very complex and it is done within the file. I wasn't sure of there was a script someone had that acompished this because inDesign itself doesn't seem to support that.
Copy link to clipboard
Copied
What do you need to move and how are items to be selected?
Can you elaborate on what you're doing?
Copy link to clipboard
Copied
I am taking item blocks that consit of images, headlines, etc. and taking them from one layer, and pasting it on numerous other layers. Right now I accomplish this by selecting a block, copy, turn on layer it needs to go to, paste in place. This gets tedious and time consuming when this has to be done to numerous layers.
Versioning in the inDesign document rather than seperate files becuase of how extensive the versioning is.
Copy link to clipboard
Copied
when selected you can alt click on the colour square in layers panel and drag the items to a new layer, alt/option will copy.
But without specifics on what's to be copied it's difficult.
Are the layers uniquely named?
Perhaps there's a way to copy and paste to specific layers with a script.
So you could copy then run the script.
Let me see if it's possible, I'm not the best with this stuff.
Copy link to clipboard
Copied
Yeah, I am aware of that feature. It still requires you doing each layer individually. The layers are uniquely named, I guess I would want a script. InDesign doesn't have it as a function.
Essentially what I want to do, is select one or more items on a layer, then select the layers I want to paste to, paste in place, and have it go to all those layers simutaniously. The layer by layer paste in place is pretty time consuming when you have many versions within one file.
Sometimes it is just copy that is being selected and pasted on multiple layers, other times it's copy and numerous photos and graphics.
Copy link to clipboard
Copied
Try this
As you have specific layer names you can adjust the layer names in the section
// Specify target layer names
You can add more layers and layer names as required.
if (app.documents.length === 0) {
alert("No document is open.");
} else {
var doc = app.activeDocument;
if (doc.selection.length === 0) {
alert("No items are selected.");
} else {
var selectedItems = doc.selection;
// Specify target layer names
var targetLayerNames = ["Layer 1", "Layer 2", "Layer 3"];
var targetLayers = [];
for (var i = 0; i < targetLayerNames.length; i++) {
var targetLayerName = targetLayerNames[i];
var layer = doc.layers.item(targetLayerName);
if (layer.isValid) {
targetLayers.push(layer);
}
}
if (targetLayers.length === 0) {
alert("No target layers found.");
} else {
for (var j = 0; j < selectedItems.length; j++) {
var currentItem = selectedItems[j];
for (var k = 0; k < targetLayers.length; k++) {
var targetLayer = targetLayers[k];
var newItem = currentItem.duplicate(targetLayer);
}
}
alert("Items copied to target layers successfully.");
}
}
}
Copy link to clipboard
Copied
Hi @Eugene Tyson, I have written a script for this too, before I saw yours. Our scripts are basically the same, but I'll post mine here, too, because it does have a couple of differences:
- Mark
/**
* Duplicate selected items to multiple layers.
* @author m1b
* @discussion https://community.adobe.com/t5/indesign-discussions/i-want-to-copy-and-paste-multiple-objects-from-one-layer-to-multiple-other-layers-at-once/m-p/13851545
*/
function main() {
if (app.documents.length == 0) {
alert('Please make a selection and try again.');
return;
}
var doc = app.activeDocument;
var settings = {
doc: doc,
showUI: true,
layers: [
// just examples, if not showing UI
doc.layers.itemByName('Layer 2'),
doc.layers.itemByName('Layer 3'),
],
};
items = settings.doc.selection;
if (
items == undefined
|| items.length == 0
) {
alert('Please make a selection and try again.');
return;
}
// show UI
if (
settings.showUI
&& chooseLayers(settings) == false
)
// user cancelled UI
return;
// sort items by index
items.sort(function (a, b) { return b.index - a.index });
// do the duplicating
for (var i = 0; i < settings.layers.length; i++)
for (var j = 0; j < items.length; j++)
items[j].duplicate(settings.layers[i]);
alert('Duplicated ' + items.length + ' items each to ' + settings.layers.length + ' layers.');
};
app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, 'Duplicate To Layers');
/**
* Shows UI for selecting layers of document.
* @author m1b
* @version 2023-06-09
* @param {Object} settings
* @param {Document} settings.doc - an Indesign Document.
*/
function chooseLayers(settings) {
var allLayers = settings.doc.layers,
selectedLayerNames = [],
w = new Window("dialog { text:'Namr', properties:{ resizeable:true } }"),
layersListBox = w.add("ListBox {alignment:['fill','fill'], properties:{multiselect:true, showHeaders:true, numberOfColumns:1, columnTitles:['Layer'] } }"),
buttons = w.add("Group { orientation: 'row', alignment: ['right','bottom'], margins:[0,12,0,22] }"),
cancelButton = buttons.add("Button { text:'Cancel', properties: { name:'cancel' } }"),
okButton = buttons.add("Button { text:'Rename', properties: { name:'ok' } }");
// populate layers menu
for (var i = 0; i < allLayers.length; i++)
layersListBox.add('item', allLayers[i].name);
/**
* Updates `selectedLayerNames`
* when listbox selection changes.
*/
layersListBox.onChange = function () {
var sel = this.selection;
selectedLayerNames = [];
settings.layers = [];
if (sel == null)
return;
for (var i = 0; i < sel.length; i++)
selectedLayerNames.push(sel[i].text);
};
if (w.show() == 2)
// user cancelled
return false;
// add the selected layers to settings object
for (var i = 0; i < selectedLayerNames.length; i++)
settings.layers.push(settings.doc.layers.itemByName(selectedLayerNames[i]));
};
Copy link to clipboard
Copied
Excellent - good thinking. Well done.
Copy link to clipboard
Copied
Why copy and paste? Select them (multiple) and move their proxy to the new layer.
Copy link to clipboard
Copied
Yes, I already suggested this, and it doesn't suit, as it has to go to multiple layers, (how many I don't know).
So with limited information, the script can copy all to layers as long as the names of the layers are there, it will copy to those layers with one action.
I can't figure out how to target selected layers, not sure if it's even possible.
Copy link to clipboard
Copied
Try pasting them on the master/parent pages. Then they will show on the page automatically.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now