Scripted equivalent of File>Import

Find out why the . goes before the /

Moderator: Paul Tuersley

Post Reply
normschaef
Posts: 1
Joined: March 6th, 2007, 7:22 am
Location: Lincoln, Nebraska
Contact:

Hi all:

I've just started to play with AE scripting this week and have found it both to be challenging and fun. (I come from a VB.NET and video production background)

I've already learned a great amount from this site by x-referencing with the Scripting Guide.

One question I haven't quit be able to get straight in my head from the guide and the examples is what steps are necessary to automate the File>Import command. (I've looked at the SmartImport.jsx) and it's a little confusing to me.

Adding various other layers seems pretty simple.
layers.addText()';
layers.addSolid(); .....

Seems like it would be really handy to have a
layers.addFile();

But instead it appears that I have to....well, I'm not quite sure what I have to do.

I've looked at the guide in footageSource, fileSource, CompItem and other places, but can't seem to make heads nor tails of it.

TIA for any help.
Norm
Norm Schaeffer
Technology Development
Enkadia
http://www.enkadia.com
User avatar
redefinery
Posts: 112
Joined: April 1st, 2005, 8:16 pm
Location: CA
Contact:

Hi Norm,

Look at the Project object's importFile() or importFileWithDialog() method to retrieve a FootageItem (or array thereof), and then use the LayerCollection object's add() method to add it as a layer. Something like:

Code: Select all

var fItem = app.project.importFile(File("myJPEGFileToImport.jpg"));
var layer = myComp.layers.add(fItem);   // myComp is the CompItem representing your comp
Hope this helps.

Jeff
Post Reply