I'm trying to script AfterFX.exe to do stuff from a command line process, seemingly like lots of people who use this interface.
I've found that AfterFX.exe (the CC version anyway) always returns 1 to the command shell if the shell waits for it to exit. I would love to use error codes to indicate success or failure but apparently despite documentation (the After Effects Scripting Guide) telling me to set exitCode however I wish... 1 is the return value. Even if exitCode is zero.
Running AfterFX.exe from the command shell directly immediately returns so the return code isn't useful. If you launch it with start /wait (i.e. start "dummy" /wait "C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX.exe" -r c:\path\to\my.jsx -noui) then the command shell doesn't come back until the app is done. You get this same behavior without the start /wait stuff if AFx is run via batch file (which is actually how I'm using it). As such, the return code is useless.
Does this happen for others, is this as designed (i.e. running After Effects is just an error, lol) or ... ?
Also,
> start "dummy" /wait "C:\Program Files\Adobe\Adobe After Effects CC\Support Files\AfterFX.exe" -s "alert('hello');app.exitCode=88" -noui
> echo %errorlevel%
1
The existence of -noui doesn't seem to affect the return code. The "dummy" bit on the command line is a requirement of start when launching apps with arguments (it's a bit esoteric but it has to be there).