I'm trying to run an ExtendScript (JSX) in Adobe After Effects 2024 using the command line option -r to execute the script. However, every time I attempt to run the command, After Effects crashes.
What I've tried:
- Using ExtendScript directly: When I manually open the .aep project file, wait 15 seconds, and then run the JSX script via the ExtendScript toolkit, it does not crash, but nothing happens.
- Running the script via the command line: It crashes as soon as I try to execute it with the -r option.
My setup:
- Operating System: Windows 10
- After Effects Version: Adobe After Effects 2024
- Script: A JSX script that opens a project, saves a backup with the suffix "_backup", and suppresses dialog boxes during execution using app.beginSuppressDialogs() and app.endSuppressDialogs(false).
Command I'm using:
"C:/Program Files/Adobe/Adobe After Effects 2024/Support Files/afterfx.exe" -r "C:/Users/Shadow/Keyframe Studio Dropbox/EP/Scripts/generated_script.jsx"
What the script does:
- Opens an existing project.
- Saves a backup of the project with the suffix "_backup" in the same directory.
- Suppresses dialog boxes (e.g., font warnings, GPU warnings) during execution.
Here is a simplified version of the script:
// Suppress dialog boxes
app.beginSuppressDialogs();
// Open the project
var projectFilePath = "C:/Users/Shadow/Keyframe Studio Dropbox/EP/Projet/anglais/master.aep";
var my_file = new File(projectFilePath);
if (my_file.exists) {
var new_project = app.open(my_file);
if (new_project) {
// Save project with "_backup" suffix
var folderPath = new_project.file.parent.fsName;
var originalFileName = new_project.file.name.split(".")[0];
var backupFileName = originalFileName + "_backup.aep";
var backupFilePath = folderPath + "/" + backupFileName;
var backupFile = new File(backupFilePath);
app.project.save(backupFile);
}
} else {
$.writeln("Project file does not exist.");
}
// Re-enable dialog boxes
app.endSuppressDialogs(false);
Problem: After Effects crashes every time I try to execute the script using the command line. However, when I manually open the project file and wait 15 seconds before running the script via ExtendScript, the script does not crash, but also does nothing. I’ve already tried:
- Running After Effects with enough delay (15 seconds) to ensure the project is fully loaded before executing the script.
- Manually opening After Effects and running the script via the UI works fine, but the command line method keeps crashing.
Has anyone experienced similar issues with After Effects crashing when running JSX scripts via -r from the command line? Any insights or solutions would be greatly appreciated!
Thanks in advance!