Page 1 of 1

duplicate project item

Posted: March 4th, 2007, 5:17 pm
by explorer
hi

i'm new to ae scripting but i got some of my scripts working somehow.
now i'm dealing with a problem: how to duplicate a project item?

i've seen in the scripting guide a way to duplicate a layer, and i tried different modifications of that to duplicate the project item, but i just cant get it to work.

any one can help?
and i just hope that the duplicate() function returns a index of the duplicated item, am i right?

oh. and btw... is there a way to add a Event Listener to AE7? for example... i have a script in Startup folder that creates a folder structure that i like to work in, but when i go to File > New project i loose it and i have to run the script by hand. is there a way to set the script to listen for event "New project" and then execute?

Posted: March 4th, 2007, 7:27 pm
by nab
Hey explorer,

1.

Code: Select all

app.project.item(1).duplicate();
returns a CompItem object if item 1 is a comp.

2. I don't think so

Posted: March 6th, 2007, 4:28 pm
by explorer
i tried that and it didn't work. thats why i writing to you. i get that duplicate() is undefined. what should i do?

CompItem.duplicate()

Posted: March 6th, 2007, 10:31 pm
by redefinery
Hi explorer,

Is the topmost (first) item in the Project panel a composition? If not, it's expected that duplicate() won't work as it's defined only for CompItem objects (i.e., compositions), not for folder or footage items.

If the first item is a comp, maybe you're using an earlier version of AE that doesn't support it? I don't have a copy of 6.0 here, but it does work in 6.5 and 7.0.

Hope that helps.

Jeff

Posted: March 7th, 2007, 6:18 am
by explorer
i have AE7.0, and what im trying to do is to automate something that i do. first step is to select a footage in the project window, duplicate it and change its interpretation. i got everything figured out but i can't duplicate the item.