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

Active document parent directory anme

Engaged ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

Can a script get the active document parent directory name?

For instance, the script gets the directory name Summer Flowers when processing the jpg images in this directory.

|- Summer Flowers

|-- flower1.jpg

|-- flower2.jpg

|-- flower3.jpg

TOPICS
Actions and scripting

Views

3.1K

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

Guide , May 30, 2018 May 30, 2018

You could use:-

alert(decodeURI(app.activeDocument.path.name));

Votes

Translate

Translate
Adobe
Engaged ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

This gets the name of the name of the parent folder of the active document. Also inserts the value %20 in the alert dialog displaying Summer%20Flowers rather than Summer Flowers. Can this %20 value be removed from the alert dialog?

var doc = app.activeDocument;

var parentFolder = doc.path.name

alert(parentFolder)

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 ,
May 29, 2018 May 29, 2018

Copy link to clipboard

Copied

ok found it. This replaces the %20 value. replace(/%20/g," ")

var doc = app.activeDocument;

var parentFolder = doc.path.name

alert(parentFolder.replace(/%20/g," "))

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
Guide ,
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

You could use:-

alert(decodeURI(app.activeDocument.path.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
Engaged ,
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

Thank you this works!

Is it possible to go up one more level to the Seasonal Flowers directory from the app.activeDocument?

I try using relative path to the Seasonal Flowers directory, but it did not work.

|- Seasonal Flowers

|-- Summer Flowers

|---flower1.jpg

|---flower2.jpg

|---flower3.jpg

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
Guide ,
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

Examples...

alert(decodeURI(app.activeDocument.path.name));

alert(decodeURI(app.activeDocument.path.parent.name));

alert(decodeURI(app.activeDocument.path.parent.parent.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
Engaged ,
May 30, 2018 May 30, 2018

Copy link to clipboard

Copied

LATEST

Thank you SuperMerlin! Super useful!

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