• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Finding Overrides in Body Page

Community Beginner ,
Sep 01, 2023 Sep 01, 2023

Copy link to clipboard

Copied

Is there a way to find overrides in the Body page when you get the Keep/Remove Overrides message?

Views

337

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
community guidelines

correct answers 1 Correct answer

Community Expert , Sep 01, 2023 Sep 01, 2023

You already know about switching from the master pages to body pages and the Overrides dialog box will be displayed. I don't know of any other way of doing this in the FrameMaker interface. This could be scripted by comparing each body page's flow text frames with those on the corresponding master page. You would have to at least check the following text frame properties: LocX, LocY, Height, and Width.

Votes

Translate

Translate
Community Expert ,
Sep 01, 2023 Sep 01, 2023

Copy link to clipboard

Copied

You already know about switching from the master pages to body pages and the Overrides dialog box will be displayed. I don't know of any other way of doing this in the FrameMaker interface. This could be scripted by comparing each body page's flow text frames with those on the corresponding master page. You would have to at least check the following text frame properties: LocX, LocY, Height, and Width.

Votes

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
community guidelines
Community Expert ,
Sep 02, 2023 Sep 02, 2023

Copy link to clipboard

Copied

From a document architect's point of view, that MP⇢BP Overrides warning is not welcome.

Save off a copy of the document.
Re-open, nav to the page, go to MP, and back, accepting Overides.
See what happens.
Try the cycle again to be sure it cleared.

 

It could be just an accidental tug on the text frame,
but might be something more interesting.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Bob, you triggered my curiosity and tested (FM-16 aka 2020) my A4_FM16-en template:

  1. Switch to Master page view
  2. Switch back to Body page view: there are 6 overrides, starting with page 3, remove them.
  3. Save the document
  4. Close the document

Open it again and check: I can repeat this to the vomit: the overrides do not go away!

Then I re-applied the desired master page to page 3 - the override does not go away...

MIF wash does not  help either...

Rick's script still reports override on each of the 18 pages!

 

And I have not the slightest idea what the overides should be.

Hopelesss situation!

You may have a look at the file -  but it uses some special fonts.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Thank you Klaus. I figured out one problem with my code: I assumed that the stacking order of the flow text frames on the body page would be the same as the stacking order of the corresponding master page. Apparently it isn't on page 1 because it is comparing the dimensions of the wrong two frames. Let me see if I can fix it.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

OK, this line:

(bpFrame.Color!== mpFrame.Color) ||

had to be changed to this:

(bpFrame.Color.Name !== mpFrame.Color.Name) ||

 

That eliminates the false positives and now I get this result for Klaus's file:

Page 3 has overrides.
Page 5 has overrides.
Page 9 has overrides.
Page 11 has overrides.
Page 13 has overrides.
Page 15 has overrides.

 

This matches the page count that FrameMaker reports but I am not sure about each page. I will try to isolate the exact override property on each page.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

"I will try to isolate the exact override property on each page"

Rick, this would be great, because visually I have no clue what could be the override.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Your Right master page has two flow A text frames directly on top of each other. That is what is causing the override message. When I delete one of the text frames from the master page, all overrides are cleared.

 

When you say Remove Overrides, FrameMaker doesn't like to remove any text frames. That is why the message persists, even after you tell it to Remove Overrides.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

re: …FrameMaker doesn't like to remove any text frames.

I was wondering if it might be case of reluctance to remove resulting in user content loss.

In this case, it's even more complex, as FM doesn't really know which duplicate object is safe to remove.
A bit surprised there's no Overlapping Object alert.

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Your Right master page has two flow A text frames directly on top of each other.

Wow, what an insight! Now I remember that I had discoverd this in many of the documentes created with this faulty template!

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

I forgot that I added a sorting to the flow text frames so that the stacking order between the body and master pages shouldn't matter. The code throws out some alerts, so you will have to clean it up, but its reporting should be more accurate.

#target framemaker

main ();

function main () {
    
    var doc;
    
    doc = app.ActiveDoc;
    if (doc.ObjectValid () === 1) {
        processDoc (doc);
    }
}

function processDoc (doc) {
    
    var masterPages, page, pageData, result;
    
    // Get all of the master pages' text frame data.
    masterPages = getMasterPagesData (doc);
    
    page = doc.FirstBodyPageInDoc;
    while (page.ObjectValid () === 1) {
        // Get the body page's text frame data.
        pageData = getBodyPageData (page);
        // See if the page has any overrides.
        result = pageHasOverrides (pageData, masterPages);
        if (result === true) {
            Console ("Page " + page.PageNumString + " has overrides.");
        }
        page = page.PageNext;
    }
}

function pageHasOverrides (pageData, masterPages) {
    
    var masterPageData, flow, bpTextFrames, mpTextFrames, differences;
    
    // Get the data for this body page's page data.
    masterPageData = masterPages[pageData.pageName];
    
    // Loop for each flow in the body page data.
    for (flow in pageData) {
        if (flow !== "pageName") {
            // Get this flow's body page text frames.
            bpTextFrames = pageData[flow];
            // Get this flow's master page text frames.
            mpTextFrames = masterPageData[flow];
            if (mpTextFrames) {
                // See if there are the same number of text frames.
                if (bpTextFrames.length === mpTextFrames.length) {
                    // Compare the dimensions of the text frames.
                    differences = flowFramesAreDifferent (bpTextFrames, mpTextFrames);
                    if (differences) {
                        alert (differences.join ("\r"));
                        return true; // Text frame properties are different.
                    }
                }
                else {
                    // Number of text frames is different.
                    alert ("Number of text frames is different for flow " + flow + ".")
                    return true; // Override is true.                
                }            
            }
            else {
                // No corresponding flow on the master page.
                alert ("No corresponding flow " + flow + " on the master page.")
                return true; // Override is true.                
            }            
        }
    }    
}

function flowFramesAreDifferent (bpTextFrames, mpTextFrames) {
    
    var count, i, bpFrame, mpFrame, differences;
    
    count = bpTextFrames.length;
    for (i = 0; i < count; i += 1) {
        bpFrame = bpTextFrames[i];
        mpFrame = mpTextFrames[i];
        // Make an array to store which properties differ.
        differences = [];
        // Many text frame properties to compare!
        if (bpFrame.LocY !== mpFrame.LocY) {
            differences.push ("LocYs are not the same.");
        }
        if (bpFrame.LocX !== mpFrame.LocX) {
            differences.push ("LocXs are not the same.");
        }
        if (bpFrame.Width !== mpFrame.Width) {
            differences.push ("Widths are not the same.");
        }
        if (bpFrame.Height !== mpFrame.Height) {
            differences.push ("Heights are not the same.");
        }
        if (bpFrame.NumColumns !== mpFrame.NumColumns) {
            differences.push ("Number of Columns are not the same.");
        }
        if (bpFrame.ColGapWidth !== mpFrame.ColGapWidth) {
            differences.push ("Column Gap Widths are not the same.");
        }
        if (bpFrame.ColumnsAreBalanced !== mpFrame.ColumnsAreBalanced) {
            differences.push ("Columns Balanced are not the same.");
        }
        if (bpFrame.SideHeadGap !== mpFrame.SideHeadGap) {
            differences.push ("Side Head Gaps are not the same.");
        }
        if (bpFrame.SideHeadPlacement !== mpFrame.SideHeadPlacement) {
            differences.push ("Side Head Placements are not the same.");
        }
        if (bpFrame.SideHeadWidth !== mpFrame.SideHeadWidth) {
            differences.push ("Side Head Widths are not the same.");
        }
        if (bpFrame.Fill !== mpFrame.Fill) {
            differences.push ("Fills are not the same.");
        }
        if (bpFrame.Pen !== mpFrame.Pen) {
            differences.push ("Pens are not the same.");
        }
        if (bpFrame.Color.Name !== mpFrame.Color.Name) {
            differences.push ("Colors are not the same.");
        }
        if (bpFrame.BorderWidth !== mpFrame.BorderWidth) {
            differences.push ("Border Widths are not the same.");
        }
        if (differences.length > 0) {
            return differences;
        }
    } 
}

function getBodyPageData (page) {
    
    var data, graphic;
    
    data = {};
    
    // Get the name of the master page that is applied.
    if (page.MasterPage === "") {
        data.pageName = (page.PageIsRecto === 1) ? "Right" : "Left";
    }
    else {
        data.pageName = page.MasterPage;
    }
    
    graphic = page.PageFrame.FirstGraphicInFrame;
    while (graphic.ObjectValid () === 1) {
        if ((graphic.constructor.name === "TextFrame") && 
            (graphic.Flow.Name !== "")) {
            flowName = graphic.Flow.Name;
            if (!data[flowName]) {
                data[flowName] = [];
            }
            data[flowName].push (graphic);
        }
        graphic = graphic.NextGraphicInFrame;
    }
    
    // Sort the body page text frames for each flow.
    sortFlowFrames (data);
        
     return data;
}

function getMasterPagesData (doc) {
    
    var data, page, pageName, graphic, flowName;
    
    data = {};
    
    page = doc.FirstMasterPageInDoc;
    while (page.ObjectValid () === 1) {
        pageName = page.Name;
        data[pageName] = {};
        graphic = page.PageFrame.FirstGraphicInFrame;
        while (graphic.ObjectValid () === 1) {
            if ((graphic.constructor.name === "TextFrame") && 
                (graphic.Flow.Name !== "")) {
                flowName = graphic.Flow.Name;
                if (!data[pageName][flowName]) {
                    data[pageName][flowName] = [];
                }
                data[pageName][flowName].push (graphic);
            }
            graphic = graphic.NextGraphicInFrame;
        }
        
        // Sort the master page text frames for each flow.
        sortFlowFrames (data[pageName]);
        
        page = page.PageNext;
    }
    
    return data;
}

function sortFlowFrames (pageData) {
    
    var flow, frames;

    for (flow in pageData) {
        if (flow !== "pageName") {
            // Get this flow's text frames and sort them
            // by LocX + LocY value.
            frames = pageData[flow];
            frames.sort (function (a, b) {
                return ((a.LocX + a.LocY) - (b.LocX + b.LocY));
            });    
        }
    }    
}

Votes

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
community guidelines
Community Expert ,
Sep 04, 2023 Sep 04, 2023

Copy link to clipboard

Copied

Yep, I get a chronic re-discovery of overrides on that too, Klaus. Also FM16.

Perhaps Rick could tweak his script to report what the offending objects are.

Votes

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
community guidelines
Community Expert ,
Sep 03, 2023 Sep 03, 2023

Copy link to clipboard

Copied

This was fun to write, but like many scripts, it was more involved than expected to get all possible overrides. It would be interesting to get some feedback on how accurate its reporting is. Right now, it writes a message to the Console for each body page in the document, but it could be polished to provide a useful report.

 

#target framemaker

main ();

function main () {
    
    var doc;
    
    doc = app.ActiveDoc;
    if (doc.ObjectValid () === 1) {
        processDoc (doc);
    }
}

function processDoc (doc) {
    
    var masterPages, page, pageData, result;
    
    // Get all of the master pages' text frame data.
    masterPages = getMasterPagesData (doc);
    
    page = doc.FirstBodyPageInDoc;
    while (page.ObjectValid () === 1) {
        // Get the body page's text frame data.
        pageData = getBodyPageData (page);
        // See if the page has any overrides.
        result = pageHasOverrides (pageData, masterPages);
        if (result === true) {
            Console ("Page " + page.PageNumString + " has overrides.");
        }
        else {
            Console ("Page " + page.PageNumString + " has no overrides.");
        }
        page = page.PageNext;
    }
}

function pageHasOverrides (pageData, masterPages) {
    
    var masterPageData, flow, bpTextFrames, mpTextFrames, result;
    
    // Get the data for this body page's page data.
    masterPageData = masterPages[pageData.pageName];
    
    // Loop for each flow in the body page data.
    for (flow in pageData) {
        if (flow !== "pageName") {
            // Get this flow's body page text frames.
            bpTextFrames = pageData[flow];
            // Get this flow's master page text frames.
            mpTextFrames = masterPageData[flow];
            if (mpTextFrames) {
                // See if there are the same number of text frames.
                if (bpTextFrames.length === mpTextFrames.length) {
                    // Compare the dimensions of the text frames.
                    result = flowFramesAreDifferent (bpTextFrames, mpTextFrames);
                    if (result === true) {
                        return true; // Text frame properties are different.
                    }
                }
                else {
                    // Number of text frames is different.
                    return true; // Override is true.                
                }            
            }
            else {
                // No corresponding flow on the master page.
                return true; // Override is true.                
            }            
        }
    }    
}

function flowFramesAreDifferent (bpTextFrames, mpTextFrames) {
    
    var count, i, bpFrame, mpFrame;
    
    count = bpTextFrames.length;
    for (i = 0; i < count; i += 1) {
        bpFrame = bpTextFrames[i];
        mpFrame = mpTextFrames[i];
        // Many text frame properties to compare!
        if ((bpFrame.LocY !== mpFrame.LocY) || 
            (bpFrame.LocX !== mpFrame.LocX) ||
            (bpFrame.Width !== mpFrame.Width) || 
            (bpFrame.Height !== mpFrame.Height) ||
            (bpFrame.NumColumns !== mpFrame.NumColumns) || 
            (bpFrame.ColGapWidth !== mpFrame.ColGapWidth) || 
            (bpFrame.ColumnsAreBalanced !== mpFrame.ColumnsAreBalanced) || 
            (bpFrame.SideHeadGap !== mpFrame.SideHeadGap) || 
            (bpFrame.SideHeadPlacement !== mpFrame.SideHeadPlacement) || 
            (bpFrame.SideHeadWidth !== mpFrame.SideHeadWidth) || 
            (bpFrame.Fill !== mpFrame.Fill) || 
            (bpFrame.Pen !== mpFrame.Pen) || 
            (bpFrame.Color !== mpFrame.Color) || 
            (bpFrame.BorderWidth !== mpFrame.BorderWidth)) {
            return true;
        }
    } 
}

function getBodyPageData (page) {
    
    var data, graphic;
    
    data = {};
    
    // Get the name of the master page that is applied.
    if (page.MasterPage === "") {
        data.pageName = (page.PageIsRecto === 1) ? "Right" : "Left";
    }
    else {
        data.pageName = page.MasterPage;
    }
    
    graphic = page.PageFrame.FirstGraphicInFrame;
    while (graphic.ObjectValid () === 1) {
        if ((graphic.constructor.name === "TextFrame") && 
            (graphic.Flow.Name !== "")) {
            flowName = graphic.Flow.Name;
            if (!data[flowName]) {
                data[flowName] = [];
            }
            data[flowName].push (graphic);
        }
        graphic = graphic.NextGraphicInFrame;
    }
    
    return data;
}

function getMasterPagesData (doc) {
    
    var data, page, pageName, graphic, flowName;
    
    data = {};
    
    page = doc.FirstMasterPageInDoc;
    while (page.ObjectValid () === 1) {
        pageName = page.Name;
        data[pageName] = {};
        graphic = page.PageFrame.FirstGraphicInFrame;
        while (graphic.ObjectValid () === 1) {
            if ((graphic.constructor.name === "TextFrame") && 
                (graphic.Flow.Name !== "")) {
                flowName = graphic.Flow.Name;
                if (!data[pageName][flowName]) {
                    data[pageName][flowName] = [];
                }
                data[pageName][flowName].push (graphic);
            }
            graphic = graphic.NextGraphicInFrame;
        }
        page = page.PageNext;
    }
    
    return data;
}

 

Votes

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
community guidelines
Community Beginner ,
Sep 05, 2023 Sep 05, 2023

Copy link to clipboard

Copied

LATEST

Thank you, this is what I suspected. In the past I've been able to flip back and forth between the MP and BP to try and detect overrides, and usually it was a difference in location or dimensions.

Votes

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
community guidelines