• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to show the file’s parent

Contributor ,
Oct 25, 2016 Oct 25, 2016

Copy link to clipboard

Copied

Hi experts,

How to show the file’s parent as below:

0001.jpg


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

TOPICS
Scripting

Views

412

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Engaged , Oct 26, 2016 Oct 26, 2016

Hi John,

Try this...

var myFolder=Folder(app.activeDocument.fullName);

alert(decodeURI(myFolder.parent.name));

alert(myFolder.parent.fsName);

Votes

Translate

Translate
Guide ,
Oct 25, 2016 Oct 25, 2016

Copy link to clipboard

Copied

alert(decodeURI(app.activeDocument.filePath))//shows path 

alert(decodeURI(app.activeDocument.fullName))//shows path and file name 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Oct 25, 2016 Oct 25, 2016

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

Hi John,

Try this...

var myFolder=Folder(app.activeDocument.fullName);

alert(decodeURI(myFolder.parent.name));

alert(myFolder.parent.fsName);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

Thank you all guys,

but how can just the file's parent not whole path?

002.jpg

regard

John

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Oct 26, 2016 Oct 26, 2016

Copy link to clipboard

Copied

LATEST

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);

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines