是否可以在 Extendscript 中抑制 CheckOut/CheckIn 对话框?

Is it possible to suppress CheckOut/CheckIn dialogs in Extendscript?

我有一个脚本,其中包含检查文档第一个故事的功能。当我 运行 this 时,会弹出一个对话框询问我是否要将文本更新到最新版本。由于此函数 运行s 在脚本的每个 运行 中多次出现,我想通过每次都回答“是”来抑制此对话框。有没有一种方法可以在这些对话框出现时自动对它们说“是”,或者只是通过自动响应来抑制它们?

function doccheckout(doc) {
    // get the main story
    var stories = doc.stories
    var story = stories.firstItem()
    // check out the main story
    story.checkOut()
    }

当我用 document.checkIn() 关闭文档时会发生同样的事情,所以我也想取消那个,但我假设第一部分的任何解决方案都适用于第二部分。

相关弹出窗口

尝试禁用用户交互:

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
// your code here
//
// at the end of your script reset it to the default
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;