InDesign Applescript:“覆盖母版页项目”故障?

问题描述 投票:0回答:4

这是一个非常简单的脚本,它覆盖第 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 中手动覆盖时,没有任何变化。它似乎正在影响特定的布局。当我做测试文档时,问题就消失了。这个特定的文档有许多级别的母版页相互应用,然后应用到布局。

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

applescript adobe-indesign
4个回答
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

0
投票

这对我有用https://forums.adobe.com/message/4294636#4294636在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
投票

这在 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

0
投票

AppleScript 覆盖命令添加了一些在 master-age 上手动移动项目时创建的移动。超级烦人。

这解决了问题:

set js to "app.menuActions.item('$ID/Override All Master Page Items').invoke();"
do script js language javascript
© www.soinside.com 2019 - 2024. All rights reserved.