• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Extendscript & After Effects with .bat

New Here ,
Aug 26, 2024 Aug 26, 2024

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

 

TOPICS
Expressions , Freeze or hang , How to , Import and export , Scripting

Views

282

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Aug 26, 2024 Aug 26, 2024

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());"

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2024 Aug 26, 2024

Copy link to clipboard

Copied

LATEST

Thanks!  I'll give this a go!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Aug 26, 2024 Aug 26, 2024

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).

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
New Here ,
Aug 26, 2024 Aug 26, 2024

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.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines