I’m attempting to automate tasks in Adobe After Effects using Python. I’ve managed to open an After Effects project with the following code:
import subprocess
import time
after_effects_path = r'path\to\AfterFX.exe'
aep_file_path = r'path\to\AfterEffect\projact.aep'
jsx_file_path = r'path\to\myAfterEffectsScript.jsx'
# Command to open After Effects with the specified project file
open_command = [after_effects_path, aep_file_path]
try:
# Execute the command
subprocess.run(open_command, check=True)
print('After Effects opened with the project file successfully.')
except subprocess.CalledProcessError as e:
print(f'Error opening After Effects with the project file: {e}')
Now, I want to execute a JSX script within After Effects using Python. I’ve tried using subprocess.run to run the JSX script, but it doesn’t seem to work as expected. Can someone provide guidance on how to run a JSX script in After Effects programmatically using Python?