Skip to content

Instantly share code, notes, and snippets.

@aescripts
Created November 27, 2017 14:48
Show Gist options
  • Save aescripts/265016f67ed5f4935f6a9ec6c2f1c2d0 to your computer and use it in GitHub Desktop.
Save aescripts/265016f67ed5f4935f6a9ec6c2f1c2d0 to your computer and use it in GitHub Desktop.
Zack Lovatt #AfterEffects #Script #KBar This script will select all layers in your comp that start after the selected layer. (It deselects the original layer.)
/***************************************************************************************
SELECT LATER LAYERS
For use w/ ft-toolbar or other script runners.
This script will select all layers in your comp that start after the selected layer.
Note: this deselects the original layer.
This script is provided "as is," without warranty of any kind, expressed
or implied. In no event shall the author be held liable for any damages
arising in any way from the use of this script.
***************************************************************************************/
function zl_selectLaterLayers() {
var thisComp = app.project.activeItem;
var compLayers = thisComp.layers;
if (compLayers.length > 0) {
var targetLayer = thisComp.selectedLayers[0];
if (targetLayer !== undefined){
targetLayer.selected = false;
for (var i = 1; i <= compLayers.length; i++){
var curLayer = compLayers[i];
if (curLayer.inPoint > targetLayer.inPoint)
curLayer.selected = true;
}
if (thisComp.selectedLayers.length == 0)
alert("No later layers!");
} else {
alert("No layer selected!");
}
} else {
alert("Comp has no layers!");
}
}
app.beginUndoGroup("Select Later Layers");
zl_selectLaterLayers();
app.endUndoGroup();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment