Hello, I have a script that imports a bunch of files, creates folders and subfolders and changes comp names. So far so good, but the problem is that I also want to change one of the layers (a picture) and replace it, on each composition, with a specific picture.
I have several functions to get the layers that should be replaced and the FootageItems that they should be replaced with. However, this doesn't seem to work with replaceSource (I get an Function item.layer is undefined error).
If i explicitly declare the project item and the project layer, the replacement works, but I need to get these from functions that return the objects.
I have attached a simplified version of the code that gives me the same error.
Thank you very much.
var myProject = app.project;
var item = myProject.item(1);
var layer = item.layer(1);
var replace = myProject.item(2);
This may happen if after importing files and creating folders your comp's index has changed and item(1) now is not a comp but some footage or folder (which don't have a layer() function and thus the error).