Copy link to clipboard
Copied
Suppose a file is open, it is current, so how to get this file unique path by JavaScript without the file name?
There are several kinds of notation. This is a URI notation. E.g. for adressing and opening files.
If you need C:\ you can get this by
alert("get path of activeDoc: "+(activeDocument.path.fsName));
Copy link to clipboard
Copied
Hi andyf65867865​,
you can read the properties of document or activeDocument in ESTK
File properties you can get by switching to Core JavaScript Classes in ESTK
In this case for a file which is already saved and opened in PS
alert("get path of activeDoc: "+activeDocument.path);
Have fun
Copy link to clipboard
Copied
suppose a file is in the c:/folder1
then your script gives a result
/c/folder1
which is slightly different... why is it?
Copy link to clipboard
Copied
This might be more like you are after...
#target photoshop;
try{
alert("get path of activeDoc: "+activeDocument.path.fsName);
}catch(e){alert("This file has not yet been saved!");}
Copy link to clipboard
Copied
Copy link to clipboard
Copied
Copy link to clipboard
Copied
There are several kinds of notation. This is a URI notation. E.g. for adressing and opening files.
If you need C:\ you can get this by
alert("get path of activeDoc: "+(activeDocument.path.fsName));