I am looking to import footage into a comp. I know the standard way of doing this is to reference the footage by its index number, but I am in a situation where that number will change depending on the file name.
Example:
I want to import cats.mov into comp but do not know ahead of time what that footage's index number will be. How do I reference cats.mov by name so that I can import it into the comp?
Also, how do I have the script add the footage to the comp at the beginning of that comp's work area?
How do I reference footage by name?
Moderator: Paul Tuersley
-
- Posts: 704
- Joined: June 5th, 2004, 7:59 am
- Location: London, UK
You'll have to loop through app.project.items looking for one with the name "cats.mov".
Use comp.layers.add() to add the layer to the comp, then set layer.startTime to comp.workAreaStart.
I haven't bothered to write the code for you but you should be able to work it out from this.
Use comp.layers.add() to add the layer to the comp, then set layer.startTime to comp.workAreaStart.
I haven't bothered to write the code for you but you should be able to work it out from this.
You can do a 'for' loop matching the name of 'cats.mov'
ex.
The second part of your question about adding the footage to the comp's work area..
ex.
You have a variable for your current comp variable named myComp..
I hope this helps.
Cheers
ex.
Code: Select all
for (i = 1; i <= app.project.items.length; i++) {
if ((app.project.item(i).name == "cat.mov") && (app.project.item(i).typeName == "Footage")) {
//do stuff
}
}
ex.
You have a variable for your current comp variable named myComp..
Code: Select all
myComp.layers.add(newFootage);
myComp.layer(1).startTime = myComp.workAreaStart;
Cheers