Search code examples
javascriptvisual-studio-codeextendscript

File($.stack).parent gives a bad result in VSCode extendscript debugger


I am trying to access the parent folder fullPath from a JSX extendscript script. So when I try to do:

$.write(File($.stack).parent.fsName);

I get:

C:\Program Files\Adobe\Adobe After Effects 2020\Support Files

However when I run this from After effects itself (go to file => scripts => run script) I get the actual parent folder's path.

I believe this has something to do with VSCode itself.

My bet is VSCode does not execute the JSX file, but copies its contents to a hidden file in After Effects/ Support Files/ and executes that instead. Any idea on how to fix the issue?


Solution

  • For anyone wondering, even after running the command:

    afterfx -r C:/Users/me/myscript.jsx
    

    from the command line, I still face the exact same issue. I believe the vscode extension that I'm using is copying the contents of my script over to the after effects installation path where afterfx.exe exists and then running some sort of bat file with a similar command. But I can at least be assured that when my script is run from the AE app, it'll yield the correct parent path.