Copy link to clipboard
Copied
Hi,
how can I check the version of project file through scripting in AE?
I am using getStyleAt() expression which was added in AE 2020 i believe. If I have a project that was created in earlier version, even if opened in AE 2022 it will say getStyleAt() function does not exist. If I import the projects to 2022 instead of opening it in 2022, it works. So I need to add a check to my script, if the project file currently opened was actually created in version 2020 or later. Similarly to app.version, but basically app.project.version. I have looked into scripting guide, no such method exists. However, there is this app.project.xmpPacket. Which i believe should contain this info. If I open old project in notepad it shows lines like:
<xmp:CreatorTool>Adobe After Effects CC 2018 (Windows)</xmp:CreatorTool>
<stEvt:softwareAgent>Adobe After Effects CC 2018 (Windows)</stEvt:softwareAgent>
But i do not see the same info when opening project created in version 2022.
Also I am no programmer, i can write a simple code, but this xmpPacket stuff is way more than i can chew.
Can anyone help me how to check the version of AE project file through scripting, please?
Thank you
I haven't tested this theory, but is it possible that the issue you're having is because the project you're opening has File > Project Settings > Expressions set to Legacy ExtendScript (which I think would cause the error you're seeing with getStyleAt())? If that's the case, then scripting has read/write access to app.project.expressionEngine, which might solve your problem. Might be worth a look/test.
Copy link to clipboard
Copied
XMP and other metadata changes constantly, so at best this is a crutch that you would have to implement extra checks for each and every version and even then it may not work. Parsing XMP was part of the standard Extend Script functions, so proabably you could have used that to extract the correct info after you had grabbed your data chunks from the file. Still, you never know the exact offsets and would need to build extra processing functions around it. Other than that I'm not aware that any such functions exist. Pretty much the same answer as to your otehr questions - AE's file format never was designed with such stuff in mind and there is simply no API for any of this.
Mylenium
Copy link to clipboard
Copied
So I did not find a way how to check version, but I figured out that I can check if my expression is valid through app.project.item(index).layer(index).propertySpec.expressionEnabled.
It does not solve the question I asked, but atleast it solves the problem I had.
Copy link to clipboard
Copied
I haven't tested this theory, but is it possible that the issue you're having is because the project you're opening has File > Project Settings > Expressions set to Legacy ExtendScript (which I think would cause the error you're seeing with getStyleAt())? If that's the case, then scripting has read/write access to app.project.expressionEngine, which might solve your problem. Might be worth a look/test.
Copy link to clipboard
Copied
Hi Dan, thank you for your answer. You were right, the project I was using was indeed set to Legacy Extendscript. I have changed it manually and the getStyleAt() works now.
However when I tried to do it via script, I am encountering (probably just visual) bug. I tried just simple:
$.writeln(app.project.expressionEngine);
app.project.expressionEngine = "javascript-1.0";
$.writeln(app.project.expressionEngine);
and I get the result :
extendscript
javascript-1.0
But visually I still see the yellow triangle next to my expression, expression giving me incorrect result and showing me error message the function getStyleAt does not exists. I have to do a manual change like moving time indicator to get rid of the error message and yellow triangle. But my script works now correctly, so probably just a visual bug.
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more