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

alm*_*now 1 macos terminal scripting adobe after-effects

我正试图弄清楚如何从命令行执行After Effects脚本.

官方文件说:

Example (for Windows):
afterfx -r c:\script_path\example_script.jsx
Run Code Online (Sandbox Code Playgroud)

没有什么适合Mac的.但是我正在尝试:

open -b com.adobe.AfterEffects --args -r /script_path/example_script.jsx
Run Code Online (Sandbox Code Playgroud)

没有任何反应.程序虽然打开了,但似乎从未调用过该脚本.

有谁想过这个?

dav*_*ron 5


这实际上是在这里记录的

您现在应该可以在Applescript中使用DoScriptFile(而不是DoScript).就像是:

tell application "Adobe After Effects CS6"
  DoScriptFile path/to/file.jsx
end tell
Run Code Online (Sandbox Code Playgroud)

您还可以通过将此方法与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
    
    Run Code Online (Sandbox Code Playgroud)
  • 从python并假设您有一台64位机器,您可以调用:

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