Question 3: If you create scripts, namespace them, and put them in the startup folder
C:\Users\<UserName>\AppData\Roaming\Adobe\FrameMaker\<Version>\startup
where <UserName> is your windows login name and <Version> is the FrameMaker version, then the scripts will load into memory when FrameMaker starts. Then you can call one script's functions from another script. For example, here is a main script that calls another one using it's namespace (which is an object) and the function name:
#target framemaker
var CP_ABC = CP_ABC || {};
CP_ABC.main = function () {
var doc;
doc = app.ActiveDoc;
if (doc.ObjectValid () === 1) {
processDoc (doc);
}
};
CP_ABC.processDoc = function (doc) {
// Do stuff here.
// Then call the other script that is in memory.
CP_XYZ.processDoc (doc);
};
CP_ABC.main ();
Here is the script whose function is being called:
#target framemaker
var CP_XYZ = CP_XYZ || {};
CP_XYZ.main = function () {
var doc;
doc = app.ActiveDoc;
if (doc.ObjectValid () === 1) {
processDoc (doc);
}
};
CP_XYZ.processDoc = function (doc) {
// Do stuff here.
};
CP_XYZ.main ();