3

Here's a very simple script that overrides all master page items on page 1:

tell application id "com.adobe.InDesign"
    tell active document
        override every item of master page items of page 1 destination page page 1
    end tell
end tell

For some reason, this results in the page items shifting up and to the left of their original location. I cannot figure out why this is happening. Overriding page items should NEVER move the items. In fact, when I manually override in InDesign, nothing shifts. It appears to be affecting a specific layout. When I do a test document, the problem goes away. This particular document has many levels of master pages applied to each other, then applied to a layout.

Anyone else encountered this issue?

  • See [this long discussion on Adobe's forum](https://forums.adobe.com/message/6315798) (intermitted by a wine toast). Unfortunately, while the thread does a good bit of exploration and offers a solution, it ends on the next page with a downer note that it "appears to not work with CC". So apparently the exact version you are using is of importance. Nevertheless, you may find a base to explore and experiment. – Jongware Aug 16 '15 at 09:56
  • I'm seeing this same problem with certain layouts. Not sure why it happens... – user1754036 Jun 15 '16 at 16:40

3 Answers3

1

I encountered the same issue. This is my workaround:

set myPageRef to object reference of myPage
        set myMPitems to master page items of myPageRef
        if (count of myMPitems) > 0 then
            repeat with myMPnumber from 1 to count of myMPitems
                tell item myMPnumber of myMPitems
                    set temp_bounds to geometric bounds
                    set myOverridden_pageItem to override destination page myPageRef
                    tell myOverridden_pageItem
                        set geometric bounds to temp_bounds
                        try -- in case of an image
                            fit given center content
                        end try
                    end tell
                end tell
            end repeat
        end if
Bertus
  • 13
  • 4
  • This works for me, InDesign 2019, OSX 10.12. None of the other suggested answers worked, as they do the same thing as the code in the original question. – Nicolai Kant Jul 22 '19 at 10:34
0

This here worked for me https://forums.adobe.com/message/4294636#4294636 in cc2014

function main() {  
    var doc = app.activeDocument,  
        i, l, page, j, k;  

    for (i = 0, l = doc.pages.length; i < l; i++) {  
        page = doc.pages[i];  
        if (page.appliedMaster !== null) {  
            for (j = 0, k = page.appliedMaster.pageItems.length; j < k; j++) {  
                try {  
                    page.appliedMaster.pageItems[j].override(page);  
                } catch(e) {}  
            }  
        }  
        page.pageItems.everyItem().detach();      
    }  
}  

if (app.documents.length > 0) {  
    app.doScript(main, ScriptLanguage.JAVASCRIPT, undefined, UndoModes.ENTIRE_SCRIPT, "Detach Master Page Items");  
}  
0

This works for me in CC 2018 (13.0.1) and Sierra 10.12.6:

tell application id "com.adobe.indesign"
    tell document 1
        repeat with i from 1 to count of pages
            try
                override (every item of master page items of page i whose allow overrides is true) destination page page i
            on error
                --
            end try
        end repeat
    end tell
end tell
Alex Filatov
  • 2,232
  • 3
  • 32
  • 39
user73082
  • 7
  • 2