I want to get the absolute folder path of current running Extendscript.
i.e __DIR__
in php (or) __dirname
in nodejs. Equivalent in Extendscript.
I want to get the absolute folder path of current running Extendscript.
i.e __DIR__
in php (or) __dirname
in nodejs. Equivalent in Extendscript.
Found it myself, it is $.fileName
For the folder name, it is (new File($.fileName)).parent
I wrote an article about this you may find helpful, :)
essentially:
var myPath = (app.activeDocument.fullName.parent.fsName).toString().replace(/\\/g, '/');
var myScriptPath = (File(app.activeScript.fullName).parent.fsName).toString().replace(/\\/g, '/');
alert('Document path is: ' + myPath + ' , and script path is: ' + myScriptPath);
mim,
If you need to reference files relative to the active document you can use app.activeDocument.filePath
.
app.activeScript.parent
should do the trick - note that if you use a windows file link, you get the actual script location, not the one of the .lnk-file.