Skip to main content
Inspiring
August 18, 2014
Answered

How do I obtain a list of a document's "FontWeightNames"

  • August 18, 2014
  • 2 replies
  • 430 views

FM 12 - Javascript

I cannot find the correct way to obtain a list of a document's "FontWeightNames"

This is as I understand it (but it does not work):

var mydocweights = MyDoc.FontWeightNames
                                        

for (var i=0; i < mydocweights.length; i++) {

                                        
  alert(mydocweights)                
                                        
}                                       
This topic has been closed for replies.
Correct answer frameexpert

FontWeightNames are not a property of a document, but of the top-level app object. Try this:

alert (app.FontWeightNames);

Rick

2 replies

Inspiring
August 18, 2014

Hi Rick,

Many thanks!

I may have been confused by the documentation  - I thought a "Session" was the open Book or Document:

"Denotes the font weight (specifies an index into the array of font weights provided by the session property

FontWeightNames)."

frameexpert
Community Expert
Community Expert
August 18, 2014

"Session" is actually the top-level-object in the FDK (Frame Developers Kit) and FrameScript. In ExtendScript, the "app" object is the equivalent. They probably used app because it is more in line with other Adobe scripting environments. The documentation was probably derived from the FDK docs and maybe that is how Session got in there.

www.frameexpert.com
Inspiring
August 18, 2014

Many thanks,

Bob

frameexpert
Community Expert
frameexpertCommunity ExpertCorrect answer
Community Expert
August 18, 2014

FontWeightNames are not a property of a document, but of the top-level app object. Try this:

alert (app.FontWeightNames);

Rick

www.frameexpert.com