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

发布于 2024-11-04 06:07:38 字数 337 浏览 4 评论 0原文

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

但什么也没有发生。虽然该程序已打开,但似乎从未调用该脚本。

有人已经弄清楚这一点了吗?

I'm trying to figure out how to execute an After Effects script from the command line.

Official documentation says:

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

And nothing for Mac. However I'm trying:

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

And nothing happens. The program get opened though, but it seems that the script is never called.

Anyone had figured out this?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(5

玩物 2024-11-11 06:07:38

这实际上已记录在此处

您现在应该能够将 DoScriptFile(而不是 DoScript)与 Applescript 一起使用。类似于:

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

您还可以通过将此方法与 MentalFish 提到的方法混合来使用外部参数调用特定函数

  • 制作一个 applescript [在本例中称为 ASfile.scpt]:

    运行 argv 时
        将 SomeName 设置为(POSIX 文件(argv 的第 1 项))
        告诉应用程序“Adobe After Effects CS6”
            DoScriptFile 一些名称
            argv 的 DoScript 第 2 项
       结束告诉
    结束运行
    
  • 从 python 并假设您有一台 64 位机器,您可以调用:

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

This is actually documented here

You should now be able to use DoScriptFile (instead of DoScript) with Applescript. Something like:

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

you can also call a specific function using external parameters by mixing this method with the one mentioned by MentalFish

  • make an applescript [in this case called 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
    
  • from python and assuming you have a 64bit machine you can call:

    ae = subprocess.call('arch -x86_64 osascript /AppleScriptLocation/ASfile.scpt %s/SomeScript.jsx "SomeFunction(\'%s\')"' %( ScriptsFolder, ParameterFromPython),shell=True)
    
§普罗旺斯的薰衣草 2024-11-11 06:07:38

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

Apparently AE on Mac does not support command line execution of scripts: http://www.aenhancers.com/viewtopic.php?f=8&t=1903

This works, create an AppleScript that tells AE to run the script via the DoScript command:

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

... and run the script via the command line as such (to run it in 32-bit mode):

arch -i386 osascript test.applescript

If you want to pass in the parameter of what script to launch you can do it like this:

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

Run the script and pass in the path to the jsx file:

arch -i386 osascript test.applescript /Users/username/Desktop/test.jsx
抠脚大汉 2024-11-11 06:07:38

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

可能有帮助吗?

you could place it in the startup folder (I use windows, the folder in win is Adobe After Effects CS4/Support Files/Scripts/Startup). Scripts in that folder are executed upon AfterEffects booting up.

Might be helpful?

黄昏下泛黄的笔记 2024-11-11 06:07:38

我想在这里提出一些很好的答案,尽管可能已经过时了。
此代码:

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"

这最适合我。

I would like to throw in here, some answers where great though possibly outdated.
This code:

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

For the applescript file works, the POSIX code does not.
Then running it in the terminal for Mojave works like this:

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

This works best for me.

神妖 2024-11-11 06:07:38

我得到了它的工作:

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

似乎我所要做的就是摆脱“r”标志。

祝你好运!

I got it working with this:

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

seems all I had to do was get rid of the 'r' flag.

Good luck!

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文