runegan / jsxbin

Convert jsx ExtendScript files into jsxbin files using ExtendScript Toolkit
MIT License
86 stars 22 forks source link

Execution error from After Effects #28

Open JRamos29 opened 3 years ago

JRamos29 commented 3 years ago

Hi, Thanks for this package. It's very useful.

I'm developing an AE Extension and it's working normally when I put the project in the extension folder without converting the .jsx files to .jsxbin.

When I convert to .jsxbin (and renaming the files to .jsx), I can execute the .jsxbin from the VSCode (with Adobe Script Runner), it is executed properly. But when I try to execute the same .jsxbin scripts from within the After Effects 2021 - Version 18.2 (with CSInterface), they don't work.

For instance, in the code below I can execute via VSCode, but when I try to execute the jsxbin from After Effects, the alert("Hostscript.jsx"); is showed up, and I get an "null is not an object" error from the line var ROOT_DIR = File($.fileName).parent.parent.fsName; and the application breaks.

UPDATE: Seems that $.fileName is returning a number instead of a string path for File() and hence returning a null object. But I don't understand why this occurs only from AE and not from VS Code.

Any clues on what can be the problem?

alert("Hostscript.jsx");

function message(msg){
    var ROOT_DIR = File($.fileName).parent.parent.fsName;
    alert(msg + " - " + ROOT_DIR);
    // alert(msg);
}
message("message");
runegan commented 2 years ago

Hi! Sorry for late reply! Have you figured this out? I'm guessing there is something about the context which the script is run. I don't have any experience with extensions, maybe they execute the script differently that how the scripts are normally run?

JRamos29 commented 2 years ago

Hi. I already tried different ways of convert to jsxbin but none of them worked. And I think that there's no difference between the execution, there are extensions using jsxbin. I still can't figure out what it's missing.