Skip to main content
frameexpert
Community Expert
Community Expert
April 10, 2020
Answered

FrameMaker ExtendScript: Finding a list of user-defined objects

  • April 10, 2020
  • 1 reply
  • 942 views

I have a bunch of scripts in my startup folder and each one creates an Object that contains its constants and functions. For example, a script may have:

 

// Create an object.
var CP = CP || {};
// Add a constant to the object.
CP.PT = 65536;
// Add a method to the object.
CP.applyPgfFmt = function (pgf, name, doc) {
    // Method code here...
};

 

My question: Is there a way to get a current list of these objects from ExtendScript while FrameMaker is running? Thank you very much. -Rick

This topic has been closed for replies.
Correct answer frameexpert

After poking around the "JavaScript Tools Guide" I found that I can do this to get the list I want:

var count, i;

count = $.global.reflect.properties.length;
for (i = 0; i < count; i += 1) {
    $.writeln ($.global.reflect.properties[i].toString ());
}

1 reply

frameexpert
Community Expert
frameexpertCommunity ExpertAuthorCorrect answer
Community Expert
April 10, 2020

After poking around the "JavaScript Tools Guide" I found that I can do this to get the list I want:

var count, i;

count = $.global.reflect.properties.length;
for (i = 0; i < count; i += 1) {
    $.writeln ($.global.reflect.properties[i].toString ());
}
www.frameexpert.com