-
Problem wit for loop in Extendscript
Hi,
I am very new to extendscript/javascript and realise theres probably an easy solution here.
My objective is to be able to import footage into AE, then run a script that counts the number of files available, and creates a corresponding comp from each footage file.(each ones specific parameters), and then to place the file inside the comp .Here is the code
var proj = app.project ;var newCompsToMake = proj.numItems;
app.beginUndoGroup("Add5Comps");
for (var i = 1; i <= newCompsToMake; i++){
proj.item(i).widthvar newCompWidth = proj.item(i).width;
var newCompNames = proj.item(i).name;
var newCompHeight = proj.item(i).height;
var newCompPAR = proj.item(i).pixelAspect;
var newCompDur = proj.item(i).duration;
var newCompFPS = proj.item(i).frameRate;proj.items.addComp(newCompNames, newCompWidth, newCompHeight, newCompPAR, newCompDur, newCompFPS);
};
app.endUndoGroup();
So in typing this I realise the problem is that each time a new comp is created it replaces the previous index, thus all the comps are being made from the same footage file.
Any ideas on how to remedy this are welcome!