I have a number of .eps files I want to save .ai and make some changes in files. One of them is to create the main layer and put all other layers as sublayers of the main and give to main layer the name of the eps file without extension. I so also this name as text in one of the layers. So, I tried two options:
1-
var FigureNumber = newLayer5.textFrames;
var FigureNumberText = FigureNumber[0].contents;
MainLayer.name = FigureNumberText;
2-
var MainLayer = doc.layers.add();
MainLayer.name = doc.name.replace(/\.[^\.]*$/, "");
on the third file, I get this error in "MainLayer.name = FigureNumberText;" or "MainLayer.name = doc.name.replace(/\.[^\.]*$/, "");" , with the two first files it's working well.
Any help, please?