Copy link to clipboard
Copied
Hi, is there a quick way how to renumber or batch rename all layers in a file so they would be named in consequent numbers? Doesn't have to start from exact number, I was wondering if maybe there is some sort of script that would help me with that? Thanks Pavel
#target illustrator
var docRef = app.activeDocument;
with (docRef) {
for (var i = 0; i < layers.length; i++) {
layers.name = layers.length - i;
}
}
Copy link to clipboard
Copied
Just put 2017 on a different machine. this one is a better machine and seems to run 2017 without issues.
new doc, single default layer, run script, press cancel, crash....
So I have no idea what is now broken.
The odd thing is that running it from ESTK does not cause issues and does not crash the software.
I know that ESTK send the script to illustrator via bridgetalk.
not sure if running the script standalone runs it in a different way.
Guess I'll be doing a bit of reading...
StrongBeaver​, if you have ESTK installed, can you try running it from there to see if it still crashes illy.
Makes it very hard to debug when it runs fine from the debugger...
Copy link to clipboard
Copied
I couldn't change the script since in the middle of a design but the script wouldn't run in ESTK due to line 27; which makes me think it may be the cause of the crashes, for me.
Then again it crashes for you on one or two layers then my theory is wrong.
Copy link to clipboard
Copied
was it the dredded PARM error?
not happy with PARM
Copy link to clipboard
Copied
Sorry, PARM error ?
Copy link to clipboard
Copied
Parm error is happily tossed to us by Adobe when something goes wrong.
the details provided with this error are some numbers that mean nothing to adobe.
and it always throws the same error, which is great in helping you find the problem.
to top it off they say that it must be due to poor coding.
I have had sections of code copied straight from the JS Reference that have caused Parm errors on certain files.
the documentation states under known issues:
http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/illustrator/sdk/CC2017/AI_ScriptGd.pdf
with all that in mind I will go back over the code and check that I don't have any scope oddities
Copy link to clipboard
Copied
Although, I never got a PARM error.