Currently I give away all my motion scripts for free. If you've found them useful and would like to support future development, you can do so here → To get updates on future ones, follow me on LinkedIn →
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 this 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.
makeColumn.jsx1.7KB
// Script to create centered nulls and parent selected layers
//
// Adds a null at the center of selected layers, named 'column1',
// 'column2', etc. Each time the script runs, it increments the
// number. Selected layers are parented to the created null.
(function() {
var comp = app.project.activeItem;
if (!(comp && comp instanceof CompItem)) {
alert("Please select a composition.");
return;
}
var selectedLayers = comp.selectedLayers;
if (selectedLayers.length === 0) {
alert("Please select at least one layer.");
return;
}
app.beginUndoGroup("Create Centered Null and Parent Layers");
// Determine the next available 'column' name
var nullIndex = 1;
while (comp.layer("column" + nullIndex)) {
nullIndex++;
}
var nullName = "column" + nullIndex;
// Calculate the center position of selected layers
var minX = Infinity, maxX = -Infinity;
var minY = Infinity, maxY = -Infinity;
for (var i = 0; i < selectedLayers.length; i++) {
var layer = selectedLayers[i];
var pos = layer.property("Position").value;
minX = Math.min(minX, pos[0]);
maxX = Math.max(maxX, pos[0]);
minY = Math.min(minY, pos[1]);
maxY = Math.max(maxY, pos[1]);
}
var centerX = (minX + maxX) / 2;
var centerY = (minY + maxY) / 2;
// Create null at the center position
var nullLayer = comp.layers.addNull(comp.duration);
nullLayer.name = nullName;
nullLayer.property("Position").setValue([centerX, centerY]);
// Parent selected layers to the null
for (var i = 0; i < selectedLayers.length; i++) {
selectedLayers[i].parent = nullLayer;
}
app.endUndoGroup();
})();