InDesign Applescript:“;“覆盖母版页项目”;差错
下面是一个非常简单的脚本,用于覆盖第1页上的所有母版页项:InDesign Applescript:“;“覆盖母版页项目”;差错,applescript,adobe-indesign,Applescript,Adobe Indesign,下面是一个非常简单的脚本,用于覆盖第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 出于某种原因,这会导致页面项目向上移动并移到其原始位置的左侧。我不明白为什么会这样。覆盖页面项时
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中手动覆盖时,没有任何变化。它似乎正在影响特定的布局。当我编写测试文档时,问题就消失了。此特定文档具有多个相互应用的母版页级别,然后应用于布局
还有其他人遇到过这个问题吗?这在2014年的CCC中对我起到了作用
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");
}
函数main(){
var doc=app.activeDocument,
i、 l,page,j,k;
对于(i=0,l=doc.pages.length;i0){
app.doScript(main,ScriptLanguage.JAVASCRIPT,未定义,UndoModes.整_脚本,“分离母版页项”);
}
这在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
我遇到了同样的问题。这是我的解决方法:
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
参见(以葡萄酒吐司为间隙)。不幸的是,虽然线程做了大量的探索并提供了一个解决方案,但在下一页结束时,它会令人沮丧地指出它“似乎不适用于CC”。因此,显然,您使用的确切版本非常重要。然而,你可能会找到一个探索和实验的基地。我在某些布局中看到了同样的问题。不知道为什么会这样……这对我来说很有效,InDesign 2019,OSX 10.12。其他建议的答案都不起作用,因为它们的作用与原始问题中的代码相同。