开发者

After Effects (Mac) Execute a Script from Terminal

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?



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)
    


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


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?


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.


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!

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜