Highlighted

FrameMaker ExtendScript: Finding a list of user-defined objects

Adobe Community Professional ,
Apr 10, 2020

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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 ());
}
TOPICS
Scripting

Views

621

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

FrameMaker ExtendScript: Finding a list of user-defined objects

Adobe Community Professional ,
Apr 10, 2020

Copy link to clipboard

Copied

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

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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 ());
}
TOPICS
Scripting

Views

622

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 10, 2020 1
Adobe Community Professional ,
Apr 10, 2020

Copy link to clipboard

Copied

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 ());
}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 10, 2020 0