-
Script for TSV importing
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