Copy link to clipboard
Copied
Hi. There's a lot of searching in the community.
I'm trying to solve the problem below using a script.
I want to put the indicator in a specific layer and finish the work area end.
For example, as shown in the attached photo,
When there's a layer of '01~06', I want to set the working area only to the activated '01~04' layer.
What method and script should I write to solve my problem?
More like this then, maybe:
var myComp = app.project.activeItem;
var maxLayer = null;
for (var i = 1; i <= myComp.numLayers; i++){
if (myComp.layer(i).hasVideo && myComp.layer(i).enabled){
if (maxLayer == null){
maxLayer = myComp.layer(i);
continue;
}
if (myComp.layer(i).outPoint > maxLayer.outPoint){
maxLayer = myComp.layer(i);
}
}
}
if (maxLayer != null){
myComp.time = maxLayer.outPoint;
myComp.workAreaStart = 0;
myComp.workAreaDuration = maxLayer.outPoint;
}
Copy link to clipboard
Copied
It could be something like this, for this specific example, but it could be a lot more complicated, depending on exactly what the rules are:
var myComp = app.project.activeItem;
try{
var myLayer = myComp.layer("04.jpg");
myComp.time = myLayer.outPoint;
myComp.workAreaStart = 0;
myComp.workAreaDuration = myLayer.outPoint;
for (var i = 1; i < myLayer.index; i++){
if (myComp.layer(i).hasVideo){
myComp.layer(i).enabled = false;
}
}
}catch(e){
}
Copy link to clipboard
Copied
Thank you, Dan.
var myLayer = myComp.layer("04.jpg");
Do not enter "04.JPG" directly in the syntax;
Is there a way to specify only the layer with the show icon on the left?
Copy link to clipboard
Copied
More like this then, maybe:
var myComp = app.project.activeItem;
var maxLayer = null;
for (var i = 1; i <= myComp.numLayers; i++){
if (myComp.layer(i).hasVideo && myComp.layer(i).enabled){
if (maxLayer == null){
maxLayer = myComp.layer(i);
continue;
}
if (myComp.layer(i).outPoint > maxLayer.outPoint){
maxLayer = myComp.layer(i);
}
}
}
if (maxLayer != null){
myComp.time = maxLayer.outPoint;
myComp.workAreaStart = 0;
myComp.workAreaDuration = maxLayer.outPoint;
}
Copy link to clipboard
Copied
@Dan Ebberts
Thank you, Dan!
This is the script I was looking for. I'll use it well.
Thanks once again.