to trigger the menu item that corresponds to that script (File > Scripts > TheScript.jsx) (I found the ID with a simple script that uses app.findMenuCommandId() like suggested in the SDK guide.)
That script runs perfectly fine, I can still display an alert on the last line of the file.
Right after that script is done (and maybe when the AEGP_DoCommand function returns), After Effects crashes with the error attached. (BEE_WorkQueue)
To debug this, I tried launching a really simple script that just makes a new null.
That first executes, but right after, AE still crashes with the same error.
After this I tried doing a different command, like ‘Play/Pause’ (ID: 10314) and that worked perfectly fine, without any crashes.
I also looked into AEGP_ExecuteScript, but we have a pretty complicated script that applies presets and we lose the references to the presets when using ExecuteScript.
Is there a way to launch a script from the menu with the DoCommand function?
I hope my explanation makes sense, let me know if I can provide any more information!