After Effects(Mac)从终端执行脚本

时间:2011-05-02 15:53:11

标签: macos scripting adobe terminal after-effects

我正在尝试弄清楚如何从命令行执行After Effects脚本。

官方文件说:

Example (for Windows):
afterfx -r c:\script_path\example_script.jsx

Mac没有任何东西。不过我正在尝试:

open -b com.adobe.AfterEffects --args -r /script_path/example_script.jsx

没有任何反应。程序虽然打开了,但似乎永远不会调用脚本。

有人想出来了吗?

5 个答案:

答案 0 :(得分:5)


实际记录为here

您现在应该可以在Applescript中使用DoScriptFile(而不是DoScript)。类似的东西:

tell application "Adobe After Effects CS6"
  DoScriptFile path/to/file.jsx
end tell

您还可以通过将此方法与MentalFish

提及的方法混合使用外部参数来调用特定函数
  • 制作一个AppleScript [在本例中称为ASfile.scpt]:

    on run argv
        set SomeName to (POSIX file (item 1 of argv))
        tell application "Adobe After Effects CS6"
            DoScriptFile SomeName
            DoScript item 2 of argv
       end tell
    end run
    
  • 来自python的
  • 假设你有64位机器,你可以打电话:

    ae = subprocess.call('arch -x86_64 osascript /AppleScriptLocation/ASfile.scpt %s/SomeScript.jsx "SomeFunction(\'%s\')"' %( ScriptsFolder, ParameterFromPython),shell=True)
    

答案 1 :(得分:1)

我得到了它的工作:

open -b com.adobe.AfterEffects --args /Users/[user]/Desktop/[folder]/file.aep
似乎我所要做的就是摆脱'r'旗帜。

祝你好运!

答案 2 :(得分:1)

显然Mac上的AE不支持脚本的命令行执行:http://www.aenhancers.com/viewtopic.php?f=8&t=1903

这样可以创建一个AppleScript,告诉AE通过DoScript命令运行脚本:

set test to (POSIX file ("/Users/username/Desktop/test.jsx"))
tell application "Adobe After Effects CSYourVersionNumber"
    DoScript test
end tell

...并通过命令行运行脚本(以32位模式运行):

arch -i386 osascript test.applescript

如果您想传入要启动的脚本的参数,可以这样做:

on run argv
    set test to (POSIX file (item 1 of argv))
    tell application "Adobe After Effects CSYourVersionNumber"
        DoScript test
    end tell 
end run

运行脚本并传入jsx文件的路径:

arch -i386 osascript test.applescript /Users/username/Desktop/test.jsx

答案 3 :(得分:1)

你可以将它放在启动文件夹中(我使用windows,win中的文件夹是Adobe After Effects CS4 /支持文件/脚本/启动)。该文件夹中的脚本在AfterEffects启动时执行。

可能会有帮助吗?

答案 4 :(得分:0)

我想在这里提出一些答案,尽管可能过时,但答案很好。 这段代码:

on run argv
    tell application "Adobe After Effects CC 2018"
        DoScriptFile item 1 of argv
    end tell
end run

对于applescript文件有效,POSIX代码无效。 然后在Mojave的终端中运行它,如下所示:

osascript AppleScriptAETest.scpt "/Users/.../Your/file/here.jsx"

这最适合我。

相关问题