Quantcast
Channel: Adobe Community : Popular Discussions - Illustrator Scripting
Viewing all articles
Browse latest Browse all 12845

duplicate layer to different document

$
0
0

Hi All,

 

I'm new to javascript and would like a little help please!!

 

I recently found a script that creates a new layer in the active document and then duplicates the contents of 'Layer 1' of the active doc to it.

 

#target illustrator

 

var docRef = app.activeDocument;

 

with(docRef) {

     var ln = 'Layer 1'

     var ol = layers.getByName(ln);

     var nl = layers.add();

     nl.name = ln+' Copy';

     for (var a = ol.pageItems.length-1; a >= 0; a--) {

          ol.pageItems[a].duplicate(nl, ElementPlacement.PLACEATBEGINNING);

     }

}

what I would like to do is duplicate a named layer in Document A into Document B. I'm not sure if duplicate is the right word as I suppose the process would have to be to copy the contents of a named layer in Document A then create a layer in Document B with the same name and paste the contents.
Any help with this would be greatly appreciated.
Many thanks,
Nik

Viewing all articles
Browse latest Browse all 12845

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>