将python脚本的结果传递给ExtendScript`.jsx`文件 [英] Passing the result of a python script to an ExtendScript `.jsx` file

查看:132
本文介绍了将python脚本的结果传递给ExtendScript`.jsx`文件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我正在编写一个python脚本,它可以从谷歌工作表中获取数据,并将其返回给我为After Effects编写的ExtendScript脚本。

>相关位是:

getSpreadsheetData.py

  def main():
values = getSpreadsheetRange(1M337m3YHCdCDcVyS4fITvAGJsw7rGQ2XGbZaKIdkJPc,A1:Q41)
return processValues(values)
pre>

afterEffectsScript.jsx

  var script_file = File(getSpreadsheetData.py); 
var results = script_file.execute();
$ .writeln(results);
alert(done!);

所以,我有三个问题:


  1. 如何将变量从 afterEffectsScript.jsx 传递给python脚本(例如电子表格ID和范围)? p>


  2. 如何从python脚本返回并将它返回给 jsx 文件?


  3. 如何让我的 afterEffectsScript 工作异步,以便它可以等待Python脚本获取它需要...


感谢您的建议!



-P

解决方案

After Effects可以调用系统命令并获得标准输出

  var cmd =pwd; 
var stdout = system.callSystem(cmd);
$ .writeln(stdout);

查看 AE脚本指南


So, I'm writing a python script that gets data from a google sheet and returns it back to an ExtendScript script that I'm writing for After Effects.

The relevant bits are :

getSpreadsheetData.py

def main():
    values = getSpreadsheetRange("1M337m3YHCdCDcVyS4fITvAGJsw7rGQ2XGbZaKIdkJPc", "A1:Q41")
    return processValues(values)

afterEffectsScript.jsx

var script_file = File("getSpreadsheetData.py");
var results = script_file.execute();
$.writeln(results);
alert("done!");

So, I have three questions :

  1. How do I pass variables from the afterEffectsScript.jsx to the python script (for example the spreadsheet id and range)?

  2. How do I get a return from the python script and return it back to the jsx file?

  3. How do I make my afterEffectsScript to work async so that it can wait for the python script to get what it needs...

Thanks in advance for the advice!

-P

解决方案

After Effects has the possibility to call system commands and get the result of stdout.

var cmd = "pwd";
var stdout = system.callSystem(cmd);
$.writeln(stdout);

Take a look into the AE Scripting Guide

这篇关于将python脚本的结果传递给ExtendScript`.jsx`文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆