Add to the JET_ReplaceWithSymbol.jsx SCript an variable to save Layer name
Hi guys i have a big illustrator file full of layers and I realized to late that I should have used symbols instead of object.
I found this amazing script that replace object by symbols:
- /*
- JET_ReplaceWithSymbol.jsx
- A Javascript for Adobe Illustrator
- Purpose: Replaces selected items with Instances of a Symbol from the Symbols Panel.
- The desired Symbol can be defined by its index number (its number of occurrance in the Panel).
- */
- var docRef=app.activeDocument;
- var symbolNum=prompt("Enter the number of the Symbol you want to replace each selected object",1);
- for(i=0;i<docRef.selection.length;i++){
- var currObj=docRef.selection;
- var currLeft=currObj.left;
- var currTop=currObj.top;
- var currWidth=currObj.width;
- var currHeight=currObj.height;
- var currInstance=docRef.symbolItems.add(docRef.symbols[symbolNum-1]);
- currInstance.width*=currHeight/currInstance.height;
- currInstance.height=currHeight;
- currInstance.left=currLeft;
- currInstance.top=currTop;
- currInstance.selected=true;
- currObj.remove();
- redraw();
- }
My only problem is that the script rename every layer name by "new symbol", I would like to keep the names like they are.
Would you have a line for me to add to the code to change that?
I tried that: var layernames =currentLayer.name (failed)
Thank you
