Trying to get path of running JSX ($.filePath not working)


i'm trying location of directory of current script (main.jsx of panel).
i've tried using $.filepath without success...

 

alert($.filepath);
returns undefined or int

 

var thisfile = new file($.filename);
alert(thisfile);

returns /c/program%20files/adobe/adobe%20photoshop%20cc%202015

 

var thisfile  = new file($.filename).parent;

alert(thisfile .fsname);

returns c:\program files\adobe\adobe photoshop cc 2015

 

what doing wrong?
i need path of running script file can .parent it's folder name, , there sibling folder name have stuff retrieve. i'm running in main.jsx -file.

hi

 

using this

file($.filename).fsname 

you'll get  c:\program files\adobe\adobe photoshop cc 2015\[scriptname.jsx]

 

using this

decodeuri(file($.filename)) 

you'll get  /c/program files/adobe/adobe photoshop cc 2015/[scriptname.jsx]

 

or, folder:

 

using this

file($.filename).parent.fsname 

you'll get  c:\program files\adobe\adobe photoshop cc 2015

 

using this

decodeuri(file($.filename).parent) 

you'll get  /c/program files/adobe/adobe photoshop cc 2015

 

you need use decodeuri() if not getting fsname, because fsname result decoded.



More discussions in Photoshop Scripting


adobe

Comments