Extendscript当前脚本路径

Ala*_*agu 16 extendscript

我想获取当前运行Extendscript的绝对文件夹路径.

即在nodejs __DIR__中的php(或)__dirname中.相当于Extendscript.

Ala*_*agu 35

它是我自己找到的 $.fileName

对于文件夹名称,它是 (new File($.fileName)).parent

  • var scriptFolder = (new File($.fileName)).parent.fsName; (2认同)

mim*_*mim 5

我写了一篇关于这个的文章,你可能会觉得有帮助,:)

本质上:

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);
Run Code Online (Sandbox Code Playgroud)

米姆,