Copy link to clipboard
Copied
Hi all. I have been learning AE Scripting for the past year or so, in order to streamline workflows for myself and my coworkers. I've got the basics down, and I'm usually able to find solutions to my issues without having to ask anyone.
I'm working on a script now, though, that is dependant on the project expression engine being set to Javascript because of some font style options. Most of my coworkers don't want to or need to know the difference, but most of our machines are set to the default Legacy ExtendScript.
I added the code
var projectEngine = app.project.expressionEngine;
if(projectEngine == "extendscript") {
alert("Wrong expression engine, blah blah");
app.project.expressionEngine = "javascript-1.0";
return false;
}which successfully changes the engine, but additional onClicks still create broken expressions.
Weirdly, if I manually go to Project Settings and check the expression engine (even without changing it), everything clicks into gear and works fine.
For now, my solution is just to change my alert to tell the user how to change the engine themselves, but I'd love for the experience to just be seamless.
My questions:
(1) In theory, should this work the way I'm using it? Have I just discovered a bug or do I just need to add some code that would "refresh" things? (as an aside - I tried adding a save and revert with executeCommand, but couldn't get that to work.)
(2) If what I did should work, why isn't that just standard code that script writers add to scripts that need to use Javascript? In my googling, I found a ton of installation instructions on scripts that tell the user to change that setting themselves. I only found one video that even had the code I used, though it wasn't a huge logical leap, referencing the scripting guide.
Any insight would be awesome. Thanks for your time.
Copy link to clipboard
Copied
Hmm, the documentation says that the property you are setting is read/write. So in general, it should work.
This really sounds like a bug you should report.
Copy link to clipboard
Copied
Thank you for responding and confirming. I'll add a bug report.
Any thoughts on why this code isn't a common practice, though? It just seems strange to me that I've not seen it around even thought the option to swich engines is several years old now. I just wondered if there might be a specific reason not to do it (other than it not working in my case).
Copy link to clipboard
Copied
It does seem like a bug that it doesn't take effect right away.
Assuming they fix it, if it were me, and my script was going to add expressions that require the JavaScript engine, I think I'd ask the user if it's OK to switch the engine, in case they've intentionally got it set to the legacy engine because of existing expressions that will break with the newer engine.
Copy link to clipboard
Copied
That makes sense, to check with the user first. I thought I might add something like this later on: https://community.adobe.com/t5/after-effects-discussions/extendscript-use-of-prompt-with-buttons/td-...
For now, though, I think I’ll just stick with the alert that informs the user how to change it themselves.
As an aside, Mr. @Dan Ebberts, I just wanted to take a second to thank you for devoting countless hours of your time to advance the knowledge of the After Effects community at large. There are so many who also deserve thanks, but for me personally, I wouldn’t be where I am in my career and as a professional if it weren’t for you. I am grateful to have your shoulders to stand on.
Copy link to clipboard
Copied
Thank you so much for the kind words--I really appreciate it!
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more