-
Closing a Precomp through script
Hi,
I am very new to scripting. Here is what I am trying to do. I have a particular layer in a precomp which has to be replaced with two new layers, which I have been able to do it. But I am unable to close the precomp tab and then close the main project. Below is the code
I am looking for the precomp “Blinking_Boxes” in the project plane and then duplicating/replacing them. Once the task is done, I am trying to close the comp using “app.project.item(i).close()”. I can close the main project but when I do that and reopen the project with precomp open.
I want this precomp close as I will be using this script for about 10000 files.
Can anyone please help me with it?
var thirdItem= app.project.item(2)
var fourthItem= app.project.item(3)for(i=1; i<=app.project.numItems;i++){
var secondItem = app.project.item(i);
if (secondItem.name == “Blinking_Boxes”)
{
var mySelection = app.project.item(i);
app.project.item(i).layer(1).duplicate()
app.project.item(i).layer(2).duplicate()app.project.item(i).layer(2) .replaceSource(thirdItem, true)
app.project.item(i).layer(3) .replaceSource(fourthItem, true)
app.project.item(i).layer(1).remove()
app.project.item(i).layer(2).moveToBeginning()
theLayer = app.project.item(i).layer(2);
theLayer.trackMatteType = TrackMatteType.LUMA
app.project.item(i).close();
}
}