How to use extendscript to open another application?

家住魔仙堡 提交于 2021-02-11 17:08:20

问题


I'm trying to undertand if/how I can open an external program from After Effects by using extendscript to send a command through the cmd line (system.callSystem), but can't work it out...

For example, to open a version of Premiere Pro from command line I can use the direct path:

cd C:\Program Files\Adobe\Adobe Premiere Pro CC 2019\ && "Adobe Premiere Pro.exe"

but can't get paths to be read through extendscript, eg I tried:

system.callSystem("cmd.exe /c \"cd C:\Program Files\Adobe\Adobe Premiere Pro CC 2019\ && "Adobe Premiere Pro.exe"\"");

How do I send cmd line commands like this through extendscript? Any help appreciated.


回答1:


I'm not sure if I fully understand your question. From Extend Script you can make a .BAT file with any commands within and execute it. Here is the example how you can open Notepad:

function run(cmd) {
    var f = new File(Folder.temp.fsName + "/temp.bat");
        f.open("w");
        f.writeln(cmd);
        f.close();
        f.execute();
}

run("c:/Windows/notepad.exe");


来源:https://stackoverflow.com/questions/63222557/how-to-use-extendscript-to-open-another-application

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!