-
Increment and add numbers in a text layer
I have a text layer that has lines with some text and a number at the end followed by a comma. I’m trying to find a way to add all the numbers together and put that value on another text layer.
For example the source text layer looks like this:
sample line 7,
apple 1,
bees 14,
USA 56,
other line 106,
etc… 45,I’m using this in the total text layer to get the number in a line:
v1=thisComp.layer(“Sample Layer”).text.sourceText.split(“,”)[0].slice(-3);Rather than making variables v1, v2, v3, v4, v5, v6, and so on, I’m wondering if there’s a way to use the i loop script or something to generate a list of just the numbers and then add them? The list will have a either 53, 66 or 87 lines.