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

Folder.commonFiles.path

Explorer ,
Sep 10, 2017 Sep 10, 2017

When I have the following line in a FrameMaker Script:

Alert(Folder.commonFiles.path)

I get the following:

I would have expected:

c:/Program Files(x86)/Common Files

FrameMaker_2017-09-10_17-47-39.jpg

TOPICS
Scripting
1.3K
Translate
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

Enthusiast , Sep 11, 2017 Sep 11, 2017

To summarize:

var oFile = Folder.commonFiles.path;

$.writeln(oFile);

var oFile = File.decode(Folder.commonFiles.path);

$.writeln(oFile);

var oFile = File.decode(Folder.commonFiles);

$.writeln(oFile);

var oFile = File.decode(Folder.commonFiles.fsName);

$.writeln(oFile);

leads to

/c/Program%20Files%20(x86)

/c/Program Files (x86)

/c/Program Files (x86)/Common Files

C:\Program Files (x86)\Common Files

So you can pick your solution, that fits for you

Translate
Enthusiast ,
Sep 10, 2017 Sep 10, 2017

You can get the expected result using fsName as follows:

Alert(Folder.commonFiles.fsName);

Translate
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 ,
Sep 10, 2017 Sep 10, 2017

Or leave off the .path property. The commonFiles property is already a "folder". When you ask for .path, it gives you the next folder up the tree.

Translate
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
Enthusiast ,
Sep 10, 2017 Sep 10, 2017

But that would just return the Object type of 'Folder'...

Translate
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 ,
Sep 10, 2017 Sep 10, 2017

I am not exactly sure what the original poster is looking for. I thought he was wondering why "Common Files" got dropped, but maybe I misunderstood.

Translate
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
Enthusiast ,
Sep 11, 2017 Sep 11, 2017

"Common Files" is dropped because that's the purpose of the path property.

bobsteamer If you use the ESTK's Object Model Viewer you will find the definition of the Folder object and its properties. The Path property is defined as "The path portion of the object absolute URI for the referenced file, without the folder name."

Translate
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
Enthusiast ,
Sep 11, 2017 Sep 11, 2017

To summarize:

var oFile = Folder.commonFiles.path;

$.writeln(oFile);

var oFile = File.decode(Folder.commonFiles.path);

$.writeln(oFile);

var oFile = File.decode(Folder.commonFiles);

$.writeln(oFile);

var oFile = File.decode(Folder.commonFiles.fsName);

$.writeln(oFile);

leads to

/c/Program%20Files%20(x86)

/c/Program Files (x86)

/c/Program Files (x86)/Common Files

C:\Program Files (x86)\Common Files

So you can pick your solution, that fits for you

Translate
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
Enthusiast ,
Sep 11, 2017 Sep 11, 2017

Klaus, there is no need to use File.decode() on line 7, fsName already does that...

Translate
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
Enthusiast ,
Sep 11, 2017 Sep 11, 2017

Hi Ian,

I know. That is only to show all different ways, results and syntaxes.

Translate
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
Explorer ,
Sep 11, 2017 Sep 11, 2017
LATEST

Originally I was looking for a preset path to the Program Folder but could only find "commonfiles" but now realise that ".path" is a path to the folder.

>leads to

>/c/Program%20Files%20(x86)

which is what I really wanted - this has solved my problem which was to call an external installed program in my script !

Sorry for the delay in replying but somehow I was not notified that there had been any replies - Many thanks.

Translate
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