How do you duplicate() a footageitem?

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
OliverWatson
Posts: 2
Joined: September 19th, 2019, 3:40 pm

My script performs a number of actions on selected clips, such as conforming their frame rates. I would like the user to have the option of keeping the original footage intact, and instead perform these actions on a set of copies. However, the .duplicate() method appears to be available only to compitems.

Is there a way to duplicate footageitems as you would by pressing command (or control) D in the project panel?
Kasio
Posts: 10
Joined: February 8th, 2008, 4:39 am

Here is a bit of a hack that works in CC2014 & CC2015 (and onwards, probably..).
( From: https://www.provideocoalition.com/after ... mmand-ids/ )
You would have to check if the command ID is valid for other AE versions..

Code: Select all

app.executeCommand(2080); // Equals Edit -> Duplicate
A more accepted way would likely be to get the file path(s) and import the file(s) on more time:

Code: Select all

 // For a single file:
var myFootage = app.project.item(3); // Hard-coded 
myFootage.selected = true;
var selectedFootagePath = myFootage.file.path + "/" + myFootage.file.name;
var duplicatedFootage = app.project.importFile(new ImportOptions(File(selectedFootagePath)));
duplicatedFootage.name = myFootage.file.name + " DUPLICATED";
Post Reply