【问题标题】:InDesign Applescript: "override master page items" glitch?InDesign Applescript:“覆盖母版页项目”故障?
【发布时间】:2015-08-13 17:04:15
【问题描述】:

这是一个非常简单的脚本,它覆盖第 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

由于某种原因,这会导致页面项目在其原始位置向上和向左移动。我无法弄清楚为什么会这样。覆盖页面项目不应移动项目。事实上,当我在 InDesign 中手动覆盖时,没有任何变化。它似乎正在影响特定的布局。当我做一个测试文档时,问题就消失了。此特定文档有许多级别的母版页,它们相互应用,然后应用到布局。

还有其他人遇到过这个问题吗?

【问题讨论】:

  • this long discussion on Adobe's forum(被酒吐司打断)。不幸的是,虽然该线程做了很多探索并提供了一个解决方案,但它在下一页结束时带有一个令人沮丧的注释,它“似乎不适用于 CC”。因此,显然您使用的确切版本很重要。不过,您可能会找到一个探索和实验的基地。
  • 我在某些布局中看到了同样的问题。不知道为什么会这样……

标签: applescript adobe-indesign


【解决方案1】:

我遇到了同样的问题。这是我的解决方法:

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

【讨论】:

  • 这对我有用,InDesign 2019,OSX 10.12。其他建议的答案都不起作用,因为它们的作用与原始问题中的代码相同。
【解决方案2】:

这在 cc2014 中对我有用 https://forums.adobe.com/message/4294636#4294636

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

【讨论】:

    【解决方案3】:

    这适用于 CC 2018 (13.0.1) 和 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
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2015-01-03
      • 1970-01-01
      • 1970-01-01
      • 2014-12-17
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多