If you want to stay in touch + hear about new tools/resources, signup here →
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.
OrderByHeight.jsx0.8KB
// OrderByHeight.jsx
(function orderByHeight() {
var comp = app.project.activeItem;
if (!(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;
}
// Sort layers by their position in the composition (y-axis) in descending order
selectedLayers.sort(function(a, b) {
return b.position.value[1] - a.position.value[1];
});
// Reorder layers in the timeline
app.beginUndoGroup("Order Layers By Height");
for (var i = 0; i < selectedLayers.length; i++) {
selectedLayers[i].moveToBeginning();
}
app.endUndoGroup();
})();