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

问题描述 投票:1回答:5

我正试图弄清楚如何从命令行执行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

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

有谁想过这个?

macos scripting adobe terminal after-effects
5个回答
1
投票

我得到了它:

open -b com.adobe.AfterEffects --args /Users/[user]/Desktop/[folder]/file.aep

似乎我所要做的就是摆脱'r'旗帜。

祝好运!


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
投票

显然,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

1
投票

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

可能有帮助吗?


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"

这对我来说效果最好。

© www.soinside.com 2019 - 2024. All rights reserved.