• Global community
    • Language:
      • Deutsch
      • English
      • EspaƱol
      • FranƧais
      • PortuguĆŖs
  • ę—„ęœ¬čŖžć‚³ćƒŸćƒ„ćƒ‹ćƒ†ć‚£
    Dedicated community for Japanese speakers
  • ķ•œźµ­ ģ»¤ė®¤ė‹ˆķ‹°
    Dedicated community for Korean speakers
Exit
0

After effects scripting to automate a process

Community Beginner ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

Hi, I am trying to automate a manual task of copying texts from Excel cells to a text layer on a particular composition in After Effects CC 2018.

Here, I am copying texts only to the layers marked with yellow and which are unlocked. So, there is a filter!

How do I code this filter in  Extendscript toolkit and extend scripting in After Effects?

Could anyone share their insights on how to implement this and a useful scripting resource would be handy?

TOPICS
Scripting

Views

4.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Enthusiast , Aug 01, 2018 Aug 01, 2018

variable "demo1" won't be an array data type, so I'm not sure that "demo1[2,0].Country" will work, and that might be causing the issue.

Does the error go away when you remove that line?

I think you don't need "eval" either.

What happens when you try:

var demo1 = footage("Testcsv.csv").dataValue([2,0]);

demo1

ā€”Arie

Votes

Translate

Translate
Enthusiast ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

Export your Excel doc as a CSV or TSV, then import that into your project panel.  Drag that item from the Project panel to your composition, then use an expression in your text layer's .sourceText() property to point to that specific CSV item.  You can learn more about data driven content on Adobe's Help site.

Also, there is commercial software like Templater from Dataclay that can do this with added flexibility of automating the visual layout when the data in your text layer changes.

Hope this helps!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

Aries solutions are very good. Also see my tool Text2Spreadsheet.ā€‹

At the bottom of the product description you find a section "Is Text2Spreadsheet the right tool for me?" that contains a summary of all competitor products (including Arie's Templater) and where the main differences are.

Cheers,

Mathias

Mathias Mƶhl - Developer of tools like BeatEdit and Automation Blocks for Premiere Pro and After Effects

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

Thanks a lot Mathias! I will have a look at the commercial software as well.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

Hi Arie! Thanks for your response. I had a look at the data-driven animation resource Work with Data-driven animation.

With the help of that resource I am using the below code in expression to access the csv file data.

eval("var demo1 ="  + footage("Testcsv.csvā€).dataValue([2,0]));

demo1[2,0].Country;

I am trying to access the 2nd row and 1st column data from the Testcsv.csv file.

But I am getting a warning: Expression disabled.

Unterminated string constant.

Could you tell me where the issue could be? Any help would be appreciated.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 01, 2018 Aug 01, 2018

Copy link to clipboard

Copied

variable "demo1" won't be an array data type, so I'm not sure that "demo1[2,0].Country" will work, and that might be causing the issue.

Does the error go away when you remove that line?

I think you don't need "eval" either.

What happens when you try:

var demo1 = footage("Testcsv.csv").dataValue([2,0]);

demo1

ā€”Arie

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 02, 2018 Aug 02, 2018

Copy link to clipboard

Copied

Perfect, this works!

Thanks, Arie.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 03, 2018 Aug 03, 2018

Copy link to clipboard

Copied

Arie,

I want to dynamically get the content from the external file to each of the input layers.

It would be great to know if it's possible to just add one extend script file(.jsx) which calls the .csv file and then import that to the project panel

or you use a slider control within After effects to dynamically call a particular row's input as opposed to writing expressions for each of the input layers to make the project more scalable.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 05, 2018 Aug 05, 2018

Copy link to clipboard

Copied

As far as I know, using the method I shared, accessing the imported data footage asset requires the use of expressions to map the data to where you want.  With Templater Rig, you map data by renaming layers to match fields in the data source and assigning an effect to that renamed layer.  In either case, users must modify layers in order for them to accept data.  You may be able to connect a numerical range slider to be a variable in the array notation.  You could have two sliders:

1.  The first allows you to select a row. 

2.  The second allows you to select a specific field

So, for each expression in a layer property that you want to receive data, you might write something like

var csv_row = <value from row slider>

var data_field = <value from field slider>

footage("my_data.csv").dataValue([csv_row, data_field]);

Hope this helps!

ā€”Arie

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

Thanks a lot for sharing this. But what are you referring as data_field??

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 06, 2018 Aug 06, 2018

Copy link to clipboard

Copied

With the "data_field" variable, it refers to the column number in your CSV / TSV. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

Ah okay! Got it. For some reason, the dataValue method takes column value first and row value later.

dataValue([data_field,csv_row]);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

Is it also possible to know how to link the slider control to the external file row and column?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

The dataValue method is a part of the footage("externalfile.csv") object.  The line of code

footage("my_data.csv").dataValue([data_field, csv_row]);

Is referencing the external "my_data.csv" file. Is there another file you want to reference?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Aug 07, 2018 Aug 07, 2018

Copy link to clipboard

Copied

I understand that dataValue method is part of footage ("externalfile.csv ") object.

But for some reason, the array value within the data Value parenthesis works in the order of

dataValue{columndata, rowdata}

I also want to know how to link the slider control value to the external file row and column

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Mar 18, 2021 Mar 18, 2021

Copy link to clipboard

Copied

LATEST

I have a problem that I think is similar.  I have multiple text layers that I want to reference a csv file.  I am trying to make it so when I dupicate one text layer, the next layer will take the next row down in the csv.  Is this possible?  Basically I want it to work in a similar function as index -1 to look at the new layer, but it needs to change the text source code that is referencing the csv data

 

Any help would be appreciated!

 

-Joel

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines