Skip to content

Instantly share code, notes, and snippets.

@GoodBoyNinja
Created June 7, 2021 20:46
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GoodBoyNinja/9546e49bd04ef6455a7156b931e645c1 to your computer and use it in GitHub Desktop.
Save GoodBoyNinja/9546e49bd04ef6455a7156b931e645c1 to your computer and use it in GitHub Desktop.
Loops through the After-Effects project items and returns an array of items that match the name that you passed into the function
function GetItemsByName (nameString) {
// returns array of found matches
if (!nameString) {
return false;
}
var matches = [];
for (var i = 1; i <= app.project.numItems; i++) {
var crnt = app.project.item(i);
var crntName = crnt.name;
var isAMatch =
nameString && crntName.indexOf(nameString) > -1 ? true : false;
if (isAMatch) {
matches.push(crnt);
}
}
return matches;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment