Script that switches Expression Engine?
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.
