In AfterEffects, I can right click on a file in the Project panel, then select "Replace Footage". After choosing an Illustrator file, the window below appears, which allows me to select a particular layer from that Illustrator file.
Is it possible to replace a FootageItem using ExtendScript and specify a certain layer of an Illustrator file?
Basics on the documentation, I've only found the FootageItem.replace( ) method. However, when I use this method, I'm unable to specify a layer of the Illustrator file.
From the scripting guide:
app.project.item(index).layer(index).replaceSource (newSource, fixExpressions)
Description:
Replaces the source for this layer.Parameters:
newSource
The new source AVItem object.fixExpressions
True to adjust expressions for the new source, false otherwise. Note that this feature can be resource-intensive; if replacing a large amount of footage, do this only at the end of the operation. See also "Project autoFixExpressions() method" on page 115.Returns: Nothing.
So I guess you should do two steps.
new ImportOptions(file);