{ // Log TimeCode.jsx // // Writes a text file of all the starting timecodes of the layers in selected comp. function logCode(myComp){ var comp_layers = myComp.layers; for (var i = comp_layers.length; i > 1; i--){ var curIn = comp_layers[i].inPoint; var curOut = comp_layers[i].outPoint; var clipDur = curOut - curIn; var curFrame = curIn / myComp.frameDuration; var clipCountPad = PadDigits(clipCount,3); var inFrame = tempText.sourceText.valueAtTime(curIn, false); var outFrame = tempText.sourceText.valueAtTime(curOut, false); var clipFrame = tempText.sourceText.valueAtTime(clipDur, false); //convert the values to strings and replace all the semi-colons with colons. inFrame = inFrame.toString(); inFrame = inFrame.replace(/;/g,":"); outFrame = outFrame.toString(); outFrame = outFrame.replace(/;/g,":"); clipFrame = clipFrame.toString(); clipFrame = clipFrame.replace(/;/g,":"); var nameOnly = comp_layers[i].name.slice(comp_layers[i].name.indexOf("_")+1, comp_layers[i].name.length); var line = clipCountPad + " AX V C " + "00:00:00:00 " + clipFrame + " " + inFrame + " " + outFrame; text_file.writeln(); text_file.writeln(line); text_file.writeln("* FROM CLIP NAME: " + comp_layers[i].name); clipCount++; } } function PadDigits(n, totalDigits) { n = n.toString(); var pd = ''; if (totalDigits > n.length) { for (i=0; i < (totalDigits-n.length); i++) { pd += '0'; } } return pd + n.toString(); } function getTimecode(curTime){ //reads the current timecode from a temporary text layer var TC = tempText.sourceText.valueAtTime(curTime, false); TC = TC.toString(); var curNums = TC.split(";"); //split the string into an array for return return curNums } var proj = app.project; var undoStr = "Comp to EDL"; writeLn("step 0"); if (proj){ writeLn("step 1"); var FinalComp = app.project.activeItem; if (FinalComp != null && (FinalComp instanceof CompItem)){ writeLn("step 2"); app.beginUndoGroup(undoStr); var text_file = filePutDialog("Select a file to output your results", "EDL", "TEXT txt"); if (text_file == null){ writeLn("step 3"); alert("No output file selected. Aborting. " ) ; } else { writeLn("step 3"); // opens file for writing. First argument is mode ("w" for writing), // second argument is file type (for mac only), // third argument is creator (mac only, "????" is no specific app). text_file.open("w","TEXT","????"); // Write the heading of the file: text_file.writeln("TITLE: " + FinalComp.name); text_file.writeln("FCM: DROP FRAME"); var tempText = FinalComp.layers.addText("TimeCode"); if(FinalComp.frameRate == 25||FinalComp.frameRate == 50){ tempText.sourceText.expression = "timeToTimecode(time + thisComp.displayStartTime, "+FinalComp.frameRate+", false)"; }else{ tempText.sourceText.expression = "timeToNTSCTimecode(time + thisComp.displayStartTime,ntscDropFrame = true, isDuration = false)"; } tempText.startTime = FinalComp.displayStartTime; var lcoll = FinalComp.layers; var minSpacing = FinalComp.frameDuration * 150; var curIn = 0 //init the time for (i=1; i