Copy link to clipboard
Copied
Hey Guys,
I am trying to delete a comp from the project using its name.
I got it to work using its index....
app.project.item(3).remove();
but I am having trouble getting it to work using its name.
Suggestions?
Thanks in advance,
Tyler
Unfortunately you can't access it directly by name. You have to loop through the project items until you find it, like this:
var myProject = app.project;
var myItem = null;
for (var i = 1; i <= myProject.numItems; i++){
if (myProject.item(i) instanceof CompItem && myProject.item(i).name == "comp name"){
myItem = myProject.item(i);
break;
}
}
Dan
Copy link to clipboard
Copied
Unfortunately you can't access it directly by name. You have to loop through the project items until you find it, like this:
var myProject = app.project;
var myItem = null;
for (var i = 1; i <= myProject.numItems; i++){
if (myProject.item(i) instanceof CompItem && myProject.item(i).name == "comp name"){
myItem = myProject.item(i);
break;
}
}
Dan
Copy link to clipboard
Copied
Worked perfectly! Thanks again Dan!
Find more inspiration, events, and resources on the new Adobe Community
Explore Now