Running a script from the command line is opening the After Effects GUI
Copy link to clipboard
Copied
Hi there,
I'm wanting to headlessly run a script using the AfterFX -r command like so:
afterfx -r c:\script.jsx
But this seems to open up the full After Effects interface, runs the script, then immediately closes After Effects, I was wondering if this is normal, is it not meant to run the script headlessly, as in no GUI? The fact that in opens up After Effects seems to defeat the point, or am I missing something?
Thanks for any clarification on this
Steve
Copy link to clipboard
Copied
Okay I've figured it out, seems that I can just use -noui to execute without opening the ui
Copy link to clipboard
Copied
The -noui flag is pretty glitchy. I'd recommend using the AfterFX.com executable for headless on Windows, or aerender.exe if you only need to render.
Copy link to clipboard
Copied
Great, thanks for the advice 👍
Copy link to clipboard
Copied
Hi
I am running the script from cmd line using -noui flag but it gives me error
and if I run this without -noui flag it opens the After Effects and run the script without any problem but -noui flag gives the warning "Could not rename the file".
this is the test script below:-
app.beginUndoGroup("test");
var myAepFile = File("~Desktop//testTemplate//testTemplate.aep");
if (myAepFile.exists) {
app.open(myAepFile); //fails on this line with app.open is not a function
}
app.project.close(CloseOptions.SAVE_CHANGES);
app.endUndoGroup();
Any help would be much appreciated
Copy link to clipboard
Copied
Try running as administrator, or reset the permissions of that file.
Copy link to clipboard
Copied
Hi Justin,
Yes I tried run it as administrator but no avails . BTW how we can change permissions of the file?
Thanks
Copy link to clipboard
Copied
I think you're on Windows, here's how: https://www.laptopmag.com/articles/take-ownership-folder-windows-10-using-file-explorer
Or you can just create a new script file in a non-restricted location and try that.
Copy link to clipboard
Copied
Hi Justin,
I have tried everything but nothing works. It's weird that it only works when After Effect is open but doesn't work when it opens in background.
Let me know if have any other solution.
Thanks anyway.

