Quantcast
Channel: Adobe Community: Message List
Viewing all articles
Browse latest Browse all 114192

Re: How do I flatten the layers in an illustrator document using extendscript

$
0
0

I've tried this instead. Basically I'm trying to take all the artwork on a particular layer and move it to another one. Once I've cleared out the layer I'll delete it so I'll effectively end up flattening the document. However I can't get this to work. Is this because I have to form a GroupItem and move everything into that then move the group item to a different layer first?

 

var doc = activeDocument;

var destination=app.activeDocument.layers[1]

$.writeln(destination.name);

 

for (var i = 0; i < doc.layers.length; i++) {

     var currentLayer = app.activeDocument.layers[i];

     $.writeln(currentLayer.name)

     if(currentLayer.name!="Contents") {

         var contents=currentLayer.hasSelectedArtwork = true;

         contents.moveTo(destination);

        

         }

   

    }


Viewing all articles
Browse latest Browse all 114192

Trending Articles



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