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.

 [fancy_header variation=”orange”]Code[/fancy_header]

// 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();

[wpdm_file id=34]

 

0 replies

Leave a Reply

Want to join the discussion?
Feel free to contribute!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.