Merge Layers and Group All Object - Adobe Illustrator Script

Merge Layers and Group All

0

This post has already been read 3352 times!

Useful handy  little script  I have found on Adobe Illustrator Scripting Forum and wanted to shared it. Script simply merge all layers on illustrator and group all objects.

 

Code

// Script by florin.popa1986
// Shared via Creativetuts.com

function main() {

if ( app.documents.length == 0 ) { return; }

app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

var doc = app.activeDocument;

var mast = doc.layers.add();

mast.name = ‘original’;
var grup=mast.groupItems.add();
// var pageIt=mast.pageItems.add();
while (doc.layers.length > 1)
{
while (doc.layers[doc.layers.length – 1].pageItems.length)
doc.layers[doc.layers.length – 1].pageItems[doc.layers[doc.layers.length – 1].pageItems.length – 1].move( grup, ElementPlacement.PLACEATBEGINNING );
doc.layers[doc.layers.length – 1].remove();
}
}
main();

 

Leave a Reply