dA-tools.com

HOME > AfterFx > Script Labs > Sample Script > CompItem obj

CompItem obj

コンポジションに含まれるレイヤーの情報
var firstComp = app.project.item(1);
alert("number of layers is " + firstComp.numLayers);
alert("name of last layer is " + firstComp.layer(firstComp.numLayers).name);
alert("name of first layer is " + firstComp.layer(1).name );
選択レイヤー名を列挙
var activeComp = app.project.activeItem;
var selectedLayers = activeComp.selectedLayers;
for (var i = 0; i < selectedLayers.length; i++) {var curLayer = selectedLayers[i];alert("Selected Layer:" + curLayer.name);
}
itemを使用しているCompの情報
var arr = app.project.item(1).usedIn;
alert(" usedIn = " + arr.length);
alert(" First used= " + arr[0].name);
alert(" id Num= " +arr[0].id);
Compのリネーム
var myCompItem = app.project.item(1);
var newName = prompt( "What would you like to name the comp?");
if (newName) {myCompItem.name = newName;
}
選択レイヤーを任意の回数複製
var num= prompt("いくつ複製?", "default");
var layers=app.project.activeItem.selectedLayers;
var baseLayer=layers[0];
for (var i=1 ;i<num;i++){baseLayer.duplicate( )
}