Copy link to clipboard
Copied
Here's my code:
{
var selectedItem = app.project.activeItem;
var thisProj = app.project;
var layerList = new Array();
var compList = new Array();
function listLayers(compNum){
for(i=1;i<=compNum.numLayers;i++){
layerList.push(compNum.layer(i).name);
}
}
function listComps(){
for(i=1;i<=thisProj.numItems;i++){
if(thisProj.item(i) instanceof CompItem){
compList.push(thisProj.item(i).name);
if(thisProj.item(i).numLayers>0){
listLayers(thisProj.item(i));
}
}
}
}
listComps();
alert("here's a list of all comp names:" + compList);
}
When I run it with ExtendScript Tool inside AE, the alert() causes this Error message:
invalid numeric result (divide by zero?)
It works fine if I only write out one of the items in the array. E.g.:
alert("blablabla"+complist[1];
Or if I leave out the '+'.
How can I write out the array or even multiple arrays in the same alert() and adding text in between?
Thanks in advance,
Fynn
Try it this way:
alert("here's a list of all comp names:" + compList.toString());
Dan
Copy link to clipboard
Copied
Try it this way:
alert("here's a list of all comp names:" + compList.toString());
Dan
Copy link to clipboard
Copied
thank you for being so quick and sorry for taking so long.
and yup - that did the trick. thanks a lot!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more