Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects extendscript: How to import file

  • Walter Soyka

    June 15, 2015 at 2:26 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   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Hamid Rohi-bilverdy

    June 15, 2015 at 5:46 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

  • Walter Soyka

    June 16, 2015 at 12:14 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   |   RenderBreak [blog]   |   Profile [LinkedIn]

  • Hamid Rohi-bilverdy

    June 16, 2015 at 7:24 pm

    Thank you Walter.

    Works like a charm….

    Yes indeed a very usefull link…

  • Alex Dinnin

    October 12, 2015 at 12:07 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

  • Walter Soyka

    October 13, 2015 at 10:25 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   |   RenderBreak [blog]   |   Profile [LinkedIn]

We use anonymous cookies to give you the best experience we can.
Our Privacy policy | GDPR Policy