// Replace highlighted footage with footage from a folder of your choice - useful for conforming an online! // By Dan Sollis, 2nd March 2004. Updated 1st July 2009. For more info, visit WWW.DIGITALDISTORTION.NET // Footage being replaced must have the same name as the replacement files (or contain the name as a string inside) // create undo group { app.beginUndoGroup("replace selected footage"); // get highlighted project items var footageToReplace = app.project.selection; // get source of replacement media var replacementMediaFolder = folderGetDialog("Point me to the folder containing the replacement quicktimes"); // now replace the footage var onlineFileArray = replacementMediaFolder.getFiles(); for (i = 0; i < footageToReplace.length; i++) { // check if current project item is footage, otherwise skip if (footageToReplace[i] instanceof FootageItem) { // get name of current file in array (for string matching) var currentProjectItemName = footageToReplace[i].name.toLowerCase(); // find the matching footage file on disk (if there is one) using the supplied item name for (p = 0; p < onlineFileArray.length; p++) { var curFileItem = onlineFileArray[p]; var curFileItemName = curFileItem.name.toLowerCase(); // if the filename of the online file exists as a string in the name of the offline proxy... if (currentProjectItemName.indexOf(curFileItemName) != -1) { //...then replace this project item with the online file onlineFileArray[p].open("r"); footageToReplace[i].replace(onlineFileArray[p]); writeLn ("replaced item " + (i+1) + " of " + (footageToReplace.length + 1)); } } } } app.endUndoGroup(); }