I copy clips from premiere pro and paste it inside AE comps a lot. Two problems here. The clips are placed at premiere pro timecode. I wrote this script to bring the pasted clips to wherever the after effects current time indicator is.
Code: Select all
// fixtime.jsx
app.beginUndoGroup("fix time");
var activeItem = app.project.activeItem;
if ((activeItem == null) || !(activeItem instanceof CompItem)) {
alert("Please select or open a composition first.");
} else {
var selectedLayers = activeItem.selectedLayers;
if (activeItem.selectedLayers.length == 0) {
alert("Nothing pasted from premire pro");
} else {
var activeComp = activeItem;
var myLayers = activeItem.selectedLayers;
for (i = 0; i <= myLayers.length - 1; i++) {
var currentLayer = myLayers[i];
currentLayer.startTime = currentLayer.startTime - currentLayer.inPoint + activeItem.time;
}
for (i = 1; i <= myLayers.length - 1; i++) {
var seqLayer = myLayers[i];
var upperLayer = myLayers[i - 1]; //alert(upperLayer.outPoint)
seqLayer.startTime = seqLayer.startTime + upperLayer.outPoint - activeItem.time;
//alert(currentLayer.outPoint);
}
}
}
app.endUndoGroup()