Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects If the file is already imported into AE, check script

  • If the file is already imported into AE, check script

    Posted by Timur Solomon on May 25, 2022 at 4:58 am

    Hi, I’m writing a script to automatically import files into AE after a render.

    I’m interested in the ability to create check conditions, the file is already imported into AE, if yes, do nothing, if not, import it.

    And I have absolutely no idea how to implement such a check for the existence of the file itself in AE.

    In what direction to move?

    var file = new File(nPath);
    if (file.exists) {} else {
    createPNG(comp, 0, File(nPath)); // Create PNG
    var importFile = app.project.importFile(new ImportOptions(File(nPath))); // Impost File
    var addComp = comp.layers.add(importFile); // Add File to Comp
    importFile.parentFolder = addComp.containingComp.parentFolder // Move File to Folder
    };
    Timur Solomon replied 3 years, 11 months ago 2 Members · 2 Replies
  • 2 Replies
  • Walter Soyka

    May 25, 2022 at 7:25 pm

    You should write a loop to walk through all of the items in the project. Compare the path of the file you’re considering importing to the path of each project item’s source. If you find a match, no need to import.

  • Timur Solomon

    May 26, 2022 at 3:47 am

    Hi Walter, thanks, i think this is what i need 👍

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