Skip to main content
Inspiring
September 10, 2017
Answered

Folder.commonFiles.path

  • September 10, 2017
  • 3 replies
  • 1177 views

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

This topic has been closed for replies.
Correct answer Klaus Göbel

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

3 replies

Klaus Göbel
Klaus GöbelCorrect answer
Legend
September 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

Ian Proudfoot
Legend
September 11, 2017

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

Klaus Göbel
Legend
September 11, 2017

Hi Ian,

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

frameexpert
Community Expert
Community Expert
September 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.

www.frameexpert.com
Ian Proudfoot
Legend
September 10, 2017

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

frameexpert
Community Expert
Community Expert
September 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.

www.frameexpert.com
Ian Proudfoot
Legend
September 10, 2017

You can get the expected result using fsName as follows:

Alert(Folder.commonFiles.fsName);