这是一个非常简单的脚本,它覆盖了第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中手动覆盖时,没有任何变化。它似乎正在影响特定的布局。当我做一个测试文档时,问题就消失了。此特定文档具有多个级别的母版页,彼此应用,然后应用于布局。
其他人遇到过这个问题吗?
答案 0 :(得分:0)
这在cc2014
中适用于我https://forums.adobe.com/message/4294636#4294636function 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");
}
答案 1 :(得分: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
答案 2 :(得分:0)
我遇到了同样的问题。这是我的解决方法:
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