Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Extendscript current script path

Tags:

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.

like image 417
Alagu Avatar asked May 16 '12 21:05

Alagu


3 Answers

Found it myself, it is $.fileName

For the folder name, it is (new File($.fileName)).parent

like image 94
Alagu Avatar answered Nov 18 '22 14:11

Alagu


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,

like image 40
mim Avatar answered Nov 18 '22 13:11

mim


File($.fileName).path;

Seems to do the job nowadays

like image 2
Maryan Hutsul Avatar answered Nov 18 '22 13:11

Maryan Hutsul