Copy link to clipboard
Copied
I need this to only run on layers in the active/open timeline and not go diving into symbols, etc.
So for example, the layers…
Man
Woman
Dog
Background
Would change to…
01 Man
02 Woman
03 Dog
04 Background
I found this in the Illustator forum, and I assumed the syntax would be similar but I can't get it to work.
var docRef = app.activeDocument;
with (docRef) {
for (var i = 0; i < layers.length; i++) {
layers.name = layers.length - i;
}
}
Any help is appreciated!
Hi.
Save this script in a .jsfl file using any text editor and execute it. Pleace notice that this script will prompt you to turn off the advanced layers mode first because layers cannot start with numbers in this mode.
var dom = fl.getDocumentDOM();
var timeline = dom.getTimeline();
var layers = timeline.layers;
var turnOffAdvancedLayers;
function main()
{
turnOffAdvancedLayers = confirm("For this script to work, the advanced layers mode needs do be turned off first. Do you want to conti
...
Copy link to clipboard
Copied
Hi.
Save this script in a .jsfl file using any text editor and execute it. Pleace notice that this script will prompt you to turn off the advanced layers mode first because layers cannot start with numbers in this mode.
var dom = fl.getDocumentDOM();
var timeline = dom.getTimeline();
var layers = timeline.layers;
var turnOffAdvancedLayers;
function main()
{
turnOffAdvancedLayers = confirm("For this script to work, the advanced layers mode needs do be turned off first. Do you want to continue?");
if (!turnOffAdvancedLayers)
return;
timeline.advancedLayersEnabled = false;
layers.forEach(function(layer, index)
{
layer.name = zeropad(index, 2) + " " + layer.name;
});
}
function zeropad(number, length) {
var str = '' + number;
while (str.length < length)
str = '0' + str;
return str;
}
main();
Learn more about scripting with JSFL and creating extensions for Animate in the following links:
https://www.adobe.io/apis/creativecloud/animate.html
https://www.adobe.io/apis/creativecloud/animate/docs.html
https://help.adobe.com/archive/pt_BR/flash/cs5/flash_cs5_extending.pdf
Regards,
JC
Copy link to clipboard
Copied
Thanks for the script and the helpful links!
Copy link to clipboard
Copied
You're welcome!