Add Named Composition from Project Panel
/*
Adds a specified composition to the current playhead time at the top of the layer stack
in the active composition.
Please replace 'COMP_NAME_HERE' with your composition's name.
If you have trouble making this work, paste the code into an LLM and explain what's happening.
Script by Jack Vaughan (jackvaughan.com/tools)
*/
(function() {
var proj = app.project;
var compName = "COMP_NAME_HERE";
var targetComp = null;
// Search for the specified composition
for (var i = 1; i <= proj.numItems; i++) {
if (proj.item(i) instanceof CompItem && proj.item(i).name === compName) {
targetComp = proj.item(i);
break;
}
}
if (targetComp) {
var activeComp = proj.activeItem;
if (activeComp && activeComp instanceof CompItem) {
app.beginUndoGroup("Add Specified Composition");
var newLayer = activeComp.layers.add(targetComp);
newLayer.startTime = activeComp.time;
app.endUndoGroup();
} else {
alert("No active composition selected.");
}
} else {
alert("Composition '" + compName + "' not found.");
}
})();
How to use the script
Always check code before running it on your computer. Even basic scripts like this one. If you’re not a developer, ask an LLM like ChatGPT, Claude, or Gemini to verify it for you.
Option 1: Install to your AE Folder
Download and install the below .jsx file in your After Effects Script folder. You can then run it using the scripts menu, or by using a launcher like Quick Menu 3.
Option 2: Adapt the script yourself
Alternatively copy the code below and develop your own version. If you’re not a developer you can do this easily with an LLM like ChatGPT.
More about my Stack
Sorry, we haven't filled this category yet!