Copy link to clipboard
Copied
Hey Folks,
I'm relatively new to scripting, picked little bits up here and there.
Trying to automate some tasks I carry our on a regular basis.
I have AE Projects that I'd like to automate using a .bat file to kick things off by opening AE, a particular AE Project, open ExtendScript and then run a script in ExtendScript to batch generate graphics and animations.
I've tried this ...
@ECho off
REM Path to After Effects executable
set AE_PATH="C:\Program Files\Adobe\Adobe After Effects 2024\Support Files\AfterFX.exe"
REM Path to the After Effects project
set PROJECT_PATH="D:\OneDrive\Gartcairn FC\Gartcairn FC Fixture Graphics.aep"
REM Path to the ExtendScript Toolkit executable
set ESTK_PATH="C:\Program Files (x86)\Adobe\Adobe ExtendScript Toolkit CC\ExtendScript Toolkit.exe"
REM Path to the JavaScript file
set SCRIPT_PATH="C:\GARTCAIRN Fixtures.jsx"
REM Open After Effects project
%AE_PATH% -project %PROJECT_PATH%
REM Wait for After Effects to open the project
timeout /t 10
REM Open ExtendScript Toolkit and run the script
start "" %ESTK_PATH% %SCRIPT_PATH%
and also split these into 2 (open ExtendScript, open script, run script) but things seem to stall until I close AE.
I've tried the .bat to open the script in ExtendScript and then run it, it opens fine but won't run the script.
The script works perfectly if I manually open the AE project, open the script in ExtendScript and then click the Start icon.
Any ideas what's missing? Do I need to tweak the .bat file or totally rethink the process?
Thanks in advance
Copy link to clipboard
Copied
You can try this. Make sure you have all the files in the correct path. Also make sure you do not put any unnecessary space before or after any variable you set incase if you change the AE, PROJECT or SCRIPT PATH variables.
@ECho off
set AE_PATH="C:\Program Files\Adobe\Adobe After Effects 2024\Support Files\AfterFX.exe"
set PROJECT_PATH="D:\OneDrive\Gartcairn FC\Gartcairn FC Fixture Graphics.aep"
set SCRIPT_PATH="C:\GARTCAIRN Fixtures.jsx"
%AE_PATH% -s "var p = File(%PROJECT_PATH%);app.open(p);var s = new File(%SCRIPT_PATH%);s.open();eval(s.read());"
Copy link to clipboard
Copied
Thanks! I'll give this a go!
Copy link to clipboard
Copied
Do you need to run the script from the editor? In the scripting guide it shows you how to launch AE from the command line and specify a script to run. Also, you could open the project from the script (assuming it's your script or you have access to the source code).
Copy link to clipboard
Copied
Thanks Dan,
I think I may have a solution, it's not quite a one click however, does what I need at the minute.
Having success by running a script in ExtendScript, requires AE to be open.
I'm opening 5-6 AE Projects and then doing some basic saves of .png files with a few delays in between to allow the AE projects to load.