Creative Communities of the World Forums

The peer to peer support community for media production professionals.

Activity Forums Adobe After Effects Expressions Script for TSV importing

  • Script for TSV importing

    Posted by Wick Van den belt on October 19, 2023 at 9:08 pm

    Hi Forum and its legends!

    I am trying to create a script that can import a TSV file and a AE-project file to use its content to create duplicates of the compositions. I am quite new to scripting, although I do understand expressions up to some extend. Over time I want to expand the scripts functions to suit the needs of certain projects, but I am trying to get it to work with a very basic script and take it from there.

    1. The script let’s me select an AE project file and a TSV file.

    2. The script will duplicate compositions based on the rows “version 1, 2, 3”, etc.( My AE template has the comps with the same name.) These duplicate comps need to be placed in a folder called “versions” with a name that is defined in the row “compName”.

    3.A. The script will rewrite the text fields for the newly created duplicates of the comp according to two rows “text one” and “text two”.
    3.B. Loop through this process for all the columns in the CSV file.

    -Currently, I have a script that I have been trying out, but it keeps breaking and I just can’t figure out where it gets stuck. By now I have spent over 32 hours on this and I just can not figure it out anymore.

    The point where I get stuck now, is that it does not seem to replace the images in the newly created pre-comps for the images. However: It does so for the first set of comps it runs through, but instead of replacing them in the precomp, it replaces them in the actual versioned comp.

    At this point I have two questions :

    1. what can I do to make the images in the pre-compositions actually be replaced by the correct images?
    (I had this working earlier in a very early version of the script, and I just simply can not find out how I get that to work again and I am pulling my hair out…)
    1a. It also seems to loop through the image import at the moment. (can’t figure out why either..)

    2. Can I additionally write some sort of logic for this script that it could do the same if a composition has more than 3 image precomps? (right now it is hard-coded to only look for 3 image precomps, but it would be cool to program it in such a way that this can be a variable that changes per template)

    I have included a basic template file, the images it uses to replace, a TSV file and the script.

    If anyone here could find where I am going wrong with this I would love you till the end of times!

    thanks so much if anyone can point me in the right direction!

    Wick

    edit: updated the ZIP file with the TSV

    Wick Van den belt replied 4 months, 1 week ago 2 Members · 2 Replies
  • 2 Replies
  • Tom Morton

    October 20, 2023 at 7:50 am

    Firstly, congrats on a beautifully written script, think you’ve done a great job commenting and formatting it and maintaining clarity throughout.

    I can’t see the problem straight off, but for interest I’ve added before and after screenshots of the project, as the original project get’s nested on import, and may affect the script locations?

    In the duplicated comp versions, the nested numbered comps get replaced with the image, rather than the image in the nested comp being replaced.

    Regards the image duplication, I get 18 images imported: the script firstly loops through 2 rows of data in the TSV file. Then it loops through the 3 versions, before calling the importImagesForPrecomp<b style=”font-family: inherit; font-size: inherit; color: var(–darkreader-text–bb-body-text-color); –darkreader-inline-color: var(–darkreader-text–darkreader-text–bb-body-text-color);” data-darkreader-inline-color=””>() function, so you’ve got 6 calls to the function. Inside the function you loop through the images 3 times, so you get 18 images imported. I can see you’ve added logic to prevent duplicates being imported but I think you’re getting some false positives here.

    I’ll let you know if I find anything else but you might find it useful to check the IF statement on line 67 and ensure it’s running correctly, as that’s the most obvious breakpoint. Test the output of the tests in the statement and ensure they’re always 100% what you expect.


  • Wick Van den belt

    October 20, 2023 at 1:50 pm

    thank you for your helpful comment thus far! I am investigating it further based on that!

    I need to keep tabs on what I am writing as I am not a programmer, so I kinda need the comments to keep track of the script. But thanks for your compliment 🙂

    Also, I have possibly found a new way to improve the image precomp duplication by looking at the number of actual numbered comps in the template. That seems to be a way that would improve functionality for potentially handling more precomps in the future.

    Thus far it’s a fun project to get my hands dirty on, and I feel I am getting quite close to make it do exactly what I need it to do. Exciting 🙂

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