Skip to main content
Inspiring
Sep 10, 2017 5:11 PM UTC
Answered

Folder.commonFiles.path

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 is closed to new replies. Start a new post to keep the conversation going.
Klaus Göbel
Klaus GöbelCorrect answer
Legend
Sep 11, 2017 9:22 AM UTC

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

9 replies

Klaus Göbel
Klaus GöbelCorrect answer
Legend
Sep 11, 2017 9:22 AM UTC

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
Ian Proudfoot
Legend
Sep 11, 2017 11:28 AM UTC

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

Translate
Klaus Göbel
Legend
Sep 11, 2017 11:36 AM UTC

Hi Ian,

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

Translate
frameexpert
Community Expert
Community Expert
Sep 10, 2017 9:40 PM UTC

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
www.frameexpert.com
Ian Proudfoot
Legend
Sep 10, 2017 10:34 PM UTC

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

Translate
frameexpert
Community Expert
Community Expert
Sep 10, 2017 11:00 PM UTC

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
www.frameexpert.com
Ian Proudfoot
Legend
Sep 10, 2017 6:21 PM UTC

You can get the expected result using fsName as follows:

Alert(Folder.commonFiles.fsName);

Translate