Copy link to clipboard
Copied
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) | |
} |
FontWeightNames are not a property of a document, but of the top-level app object. Try this:
alert (app.FontWeightNames);
Rick
Copy link to clipboard
Copied
FontWeightNames are not a property of a document, but of the top-level app object. Try this:
alert (app.FontWeightNames);
Rick
Copy link to clipboard
Copied
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)."
Copy link to clipboard
Copied
"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.
Copy link to clipboard
Copied
Many thanks,
Bob