Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
将python脚本的结果传递给ExtendScript`.jsx`文件_Python_Google Sheets_Jsx_Extendscript - Fatal编程技术网

将python脚本的结果传递给ExtendScript`.jsx`文件

将python脚本的结果传递给ExtendScript`.jsx`文件,python,google-sheets,jsx,extendscript,Python,Google Sheets,Jsx,Extendscript,因此,我正在编写一个python脚本,该脚本从google工作表中获取数据,并将其返回到我正在为后效编写的ExtendScript脚本 相关位为: getSpreadsheetData.py def main(): values = getSpreadsheetRange("1M337m3YHCdCDcVyS4fITvAGJsw7rGQ2XGbZaKIdkJPc", "A1:Q41") return processValues(values) 后效脚本.jsx var scri

因此,我正在编写一个python脚本,该脚本从google工作表中获取数据,并将其返回到我正在为后效编写的ExtendScript脚本

相关位为:

getSpreadsheetData.py

def main():
    values = getSpreadsheetRange("1M337m3YHCdCDcVyS4fITvAGJsw7rGQ2XGbZaKIdkJPc", "A1:Q41")
    return processValues(values)
后效脚本.jsx

var script_file = File("getSpreadsheetData.py");
var results = script_file.execute();
$.writeln(results);
alert("done!");
因此,我有三个问题:

  • 如何将变量从
    afterEffectsScript.jsx
    传递到python脚本(例如电子表格id和范围)

  • 如何从python脚本获取返回并将其返回到
    jsx
    文件

  • 如何使我的
    afterEffectsScript
    异步工作,以便它可以等待python脚本获得所需的内容

  • 提前谢谢你的建议


    -p

    您可以通过设置环境变量来传递变量。 如何使用extendscript中的参数调用外部脚本的小示例:

    var script_file = File("getSpreadsheetData.py");
    $.setenv("arg_1", "arg1_value");
    $.setenv("arg_2", "arg2_value");
    script_file.execute();
    

    python脚本应该首先从环境中读取以下变量:

    After Effects可以调用系统命令并获得stdout的结果

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

    看看

    啊哈,这听起来像是解决第1点和第2点的办法!当环境变量改变值以回答第3点时,是否有办法倾听?我假设我会从python操作一个环境变量&从ExtendScript访问它,而不是像我在这里所做的那样使用
    results
    变量