Copy link to clipboard
Copied
Hi experts,
How to show the file’s parent as below:
Assume I double click the target file, and the file is open as active Document, how can I make a code to show the file parent. I mean the folder which contain the target file.
Thanks
Regard
John
Hi John,
Try this...
var myFolder=Folder(app.activeDocument.fullName);
alert(decodeURI(myFolder.parent.name));
alert(myFolder.parent.fsName);
Copy link to clipboard
Copied
alert(decodeURI(app.activeDocument.filePath))//shows path
alert(decodeURI(app.activeDocument.fullName))//shows path and file name
Copy link to clipboard
Copied
Hi John,
in case you double-click the InDesign document, the document will open.
And from the open document you can get the parent folder opened in your file system:
File(app.documents[0].fullName).parent.execute();
Tested on Mac OSX 10.6.8. Should also work on Windows.
Regards,
Uwe
Copy link to clipboard
Copied
Hi John,
Try this...
var myFolder=Folder(app.activeDocument.fullName);
alert(decodeURI(myFolder.parent.name));
alert(myFolder.parent.fsName);
Copy link to clipboard
Copied
Thank you all guys,
but how can just the file's parent not whole path?
regard
John
Copy link to clipboard
Copied
Hi,
This code shows only the parent folder name
var myFolder=Folder(app.activeDocument.fullName);
alert(decodeURI(myFolder.parent.name));
This code shows full path
alert(myFolder.fsName);