Skip to main content
Participant
January 20, 2022
Question

CSVファイルからデータを取得する際に、エクスプレッションでの座標指定にコンポジション名を使用する方法

  • January 20, 2022
  • 1 reply
  • 407 views

 

 

まずコンポジション名が「text_1」だとして
エクスプレッションを使って
thisComp.name.replace(/[^0-9]/g,””);
でコンポジション名から「1」を取得できます

 

そして「excel_text」という名前のcsvファイルから列(main_text)の行(1)のテキストデータを参照するために
ソーステキストにthisComp.layer(“excel_text.csv”)(“データ”)(“Outline”)(“main_text”)(“main_text 1)
を書いたとします

 

この時の(“main_text 1)の1の部分にコンポジション名から取得した「1」を入力したい場合はどの様に記述すればいいのでしょうか?

This topic has been closed for replies.

1 reply

Community Expert
January 21, 2022

+ を使って連結してはどうでしょう。

 

 

 

let c =thisComp.name.slice(5);
thisComp.layer("excel_text.csv")("データ")("Outline")("main_text")("main_text " + c)

 

 

 

<追記>

エクスプレッションを修正しました。

Community Expert
January 22, 2022

<追記>

main_text 0から始まっている場合、一つズレているかもしれません。

下記の方法で修正できそうです。

 

 

let c =thisComp.name.charAt(5) ;
let d = c - 1;
thisComp.layer("excel_text.csv")("データ")("Outline")("main_text")("main_text " + d)

 

 

 

Participant
January 30, 2022

ありがとうございます!

できました!