// Replace highlighted footage with footage from a folder of your choice - useful for conforming an online from an AVID edit imported via Automatic Duck! // By Dan Sollis, 22nd April 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 the first 16 characters) // This is a revised RED-specific version of a generic replace footage script I wrote a while ago. // 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(); // RED specific stuff - shorten search string to 16 characters - as AVID has mangled the long filenames in the project! var curFileItemName = curFileItemName.substring(0,15); // 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(); }