• 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 get docs full path without a "~"

New Here ,
Jun 02, 2016 Jun 02, 2016

Copy link to clipboard

Copied

My file is here:

     "C:\Users\first.last\Desktop\PS_Tester\SRC\Work.psd" 

Note that doc is on the desktop (Windows).

This code:

        var MyTest = activeDocument.fullName;

        alert(MyTest);

Returns:

     "~/Desktop/PS_Tester/SRC/Work.psd"

I would like and expect it to return the actual path with the "C:\Users\first.last" and not the "~".

When I pass the ~Path to another app madness occurs.

Or is there a way to get what the tilde represents?

TOPICS
Actions and scripting

Views

469

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

Community Expert , Jun 02, 2016 Jun 02, 2016

Just a slight correction, for the alert. using a forward slash isn't keeping with what you'll get returned, which will be all the normal backslashes. You need a double backslash:

alert(MyTest+"\\"+app.activeDocument.name); 

Votes

Translate

Translate
Adobe
Guide ,
Jun 02, 2016 Jun 02, 2016

Copy link to clipboard

Copied

activeDocument.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
New Here ,
Jun 02, 2016 Jun 02, 2016

Copy link to clipboard

Copied

that returns "undefined"   ???

But it got me going in the correct direction:

var MyTest = (app.activeDocument.fullName.parent).fsName;

Returns:

"C:\Users\first.last\Desktop\PS_Tester\SRC\"

Which gets me something without a tilde.

Thanks for the pointer!

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 ,
Jun 02, 2016 Jun 02, 2016

Copy link to clipboard

Copied

Hi Mrapelje,

Try This Code..

var MyTest = (app.activeDocument.path).fsName;

(or)

var MyTest = (app.activeDocument.fullName.parent).fsName;

alert(MyTest+"/"+app.activeDocument.name);

- yajiv

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 ,
Jun 02, 2016 Jun 02, 2016

Copy link to clipboard

Copied

Just a slight correction, for the alert. using a forward slash isn't keeping with what you'll get returned, which will be all the normal backslashes. You need a double backslash:

alert(MyTest+"\\"+app.activeDocument.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
New Here ,
Jun 03, 2016 Jun 03, 2016

Copy link to clipboard

Copied

LATEST

You are correct sir...  I had a couple of lines that added the file name and fixed all the slashes. 

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