ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

extendscript: How to import file

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Hamid Rohi-Bilverdy
extendscript: How to import file
on Jun 14, 2015 at 8:24:55 am

What is the simple extendscript code for importing a file??

One or more files should be able to import.


Return to posts index

Walter Soyka
Re: extendscript: How to import file
on Jun 15, 2015 at 2:26:50 pm

newFootageItem = app.project.importFile(new ImportOptions(new File("/absolute/path/to/file.jpg")));

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Hamid Rohi-Bilverdy
Re: extendscript: How to import file
on Jun 15, 2015 at 5:46:33 pm

Thank you Walter

2 questions.

1:
I am not so good at paths in scripting, so i changed the line ("/absolute/path/to/file.jpg") to ("bird.png") which basiclly did what it was suppose to. I copied a file of bird.png and placed it inside the folder where i have the script running from. What would be the path for the desktop?? And when people sell scripts or download others scripts, how do they make sure that the logo image file is placed the correct place or is there a way to embedd a image??

2:
Thank you for taking the time to help me, and thanks for this script, but this code loads an actual file which I determine, what I was looking for was something like when you hit the Ctrl + i on the keyboard and get the import file dialog where to use a random file to import.

//Hamid


Return to posts index



Walter Soyka
Re: extendscript: How to import file
on Jun 16, 2015 at 12:14:30 am

[Hamid Rohi-Bilverdy] "What would be the path for the desktop?"

That's probably platform-dependent.


[Hamid Rohi-Bilverdy] "And when people sell scripts or download others scripts, how do they make sure that the logo image file is placed the correct place or is there a way to embedd a image??"

Usually that would be handled in an AEP template, not in the script.


[Hamid Rohi-Bilverdy] "what I was looking for was something like when you hit the Ctrl + i on the keyboard and get the import file dialog where to use a random file to import. "

app.project.importFileWithDialog();

There's a lot of great information in the Ae scripting guide [link], just in case you haven't seen it.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Hamid Rohi-Bilverdy
Re: extendscript: How to import file
on Jun 16, 2015 at 7:24:18 pm

Thank you Walter.

Works like a charm....

Yes indeed a very usefull link...


Return to posts index

alex dinnin
Re: extendscript: How to import file
on Oct 12, 2015 at 12:07:05 pm

This is great.. just tagged on to this.

Is there any way to specify a folder in the AE project to import the file into ??

Cheers

Alex



Return to posts index


Walter Soyka
Re: extendscript: How to import file
on Oct 13, 2015 at 10:25:00 am

[alex dinnin] "Is there any way to specify a folder in the AE project to import the file into ??"

No, but you can move the files into the folder immediately after they're imported.

app.project.importFileWithDialog() returns an array of items. Iterate through that array and set each item's parentFolder attribute to the folder into which you wanted to import them.

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]