app.activeDocument 在后台打开文档时在 indesign 中出现错误

app.activeDocument giving an error in indesign when opening document in the background

我是 Adob​​e 产品脚本的新手,当我在后台打开文档后尝试使用 app.activeDocument 来处理文档。它给出了一个错误。

请帮忙。

app.activeDocument 仅当文档在前面打开时有效,这意味着文档可见时。 如果您想在后台打开文档时访问打开的文档,请使用 app.documents[0] 而不是 app.activeDocumentapp.documents[0] 也指最前面的文档,但它也适用于在后台打开文档时。

尝试使用 app.documents[0],这将解决您的问题。