Detect excluded book components on FM via scripting
Hi, I am a beginner and I would like to write a script where excluded book components on FrameMaker can be automatically detected. However, I am stuck somehow even though I went through the entire pdf documentation several times. This is the code I was working on so far:
main();
function main() {
var book = app.ActiveBook;
if(!book.ObjectValid())
{
book = app.FirstOpenBook;
}
var bookComponentsPaths = []
var comp = book.FirstComponentInBook;
while(comp.ObjectValid())
{
comp.ComponentIsSelected = true;
var compType = comp.ComponentType;
if(compType == Constants.FV_BK_FILE)
{
var doc = OpenFile(comp.Name);
if (doc.ObjectValid() == true)
{
bookComponentsPaths.push(comp.Name);
}
comp = comp.NextBookComponentInDFSOrder;
if (comp.ExcludeComponent = "Yes") {
alert("This file has a excluded component: " + comp.Name);
}
}
}
/*
if (bookComponentsPaths.indexOf(comp.ElementIsExcludedInContext) === -1)
{
alert("This component is excluded: " + comp.Name);
}
*/
}
I have tried with 'ExcludeComponent' and 'ElementIsExcludedInContext' and both did not work.
For testing, I also wrote a script going through the entire book and giving me the output of all components and the (apparently) excluded book component seems to be still detected by the script?? Is there something I might miss?
