/* "findMissingFootagesInComp.jsx" www.nabscripts.com, 10.2006 Finds missing footages in the selected comp and (optionally) removes them. */ { function findMissingFootagesInComp(theComp) { // retrieves missing footages in the array "missingFootages" for (var i = 1; i <= theComp.numLayers; i++) { var curLayerSource = theComp.layer(i).source; if (curLayerSource != null && curLayerSource.footageMissing == true && IsInArray(curLayerSource,missingFootages) == false) // if it has not been already retrieved // add footage in the array missingFootages[missingFootages.length] = curLayerSource; else if (curLayerSource instanceof CompItem) // this is a comp, recursive call findMissingFootagesInComp(curLayerSource); } return missingFootages; } function removeMissingFootages(theFootages) { // asks the user...and removes missing footages var removeMissing = false; if (theFootages.length == 0) alert("No missing footages in " + "\"" + myComp.name + "\"."); else if (theFootages.length == 1) removeMissing = confirm(theFootages.length + " footage is missing in " + "\"" + myComp.name + "\".\r" + "Do you want to remove it ?"); else removeMissing = confirm(theFootages.length + " footages are missing in " + "\"" + myComp.name + "\".\r" + "Do you want to remove them ?"); if (removeMissing) { for (i = 0; i < theFootages.length; i++) theFootages[i].remove(); } } function IsInArray(theElement,theArray) { var isIn = false; for (var i = 0; i < theArray.length; i++) { if (theElement == theArray[i]) isIn = true; } return isIn; } // MAIN SCRIPT var myComp = app.project.selection[0]; if (myComp == null || !(myComp instanceof CompItem)) alert("Select a comp in the project panel and run the script again."); else { app.beginUndoGroup("findMissingFootagesInComp.jsx"); var missingFootages = new Array(); findMissingFootagesInComp(myComp); removeMissingFootages(missingFootages); app.endUndoGroup(); } }