InDesign jsx 使用特定选项打开文件

问题描述

我正在尝试批处理多年前在旧版 InDesign 上创建的 .indd 文件

我有两个目标:

  1. 打开 .indd文件而无需手动点击 对话框:- “更新链接的图像?(选择“更新”)”“字体错误 (选择“跳过”)”
  2. 文件保存为 .indd,当前版本的原生格式,将 _cc2020 附加到其原始文件名。

这是我目前的做法:

// opening files

// specify source folder
path = '~/Desktop/source_dir';

// list files in the folder
var my_folder = new Folder(path);
list_of_files = my_folder.getFiles();

// open file(s)
fileObj = app.open(list_of_files);


// saving files
// get current documents
myDoc = app.activeDocument;

// save current document with specific name
myDoc.save(File('~/Desktop/test01.indd'));

我找不到抑制(或提供预设认值)这两个对话框的方法。 有人可以启发我如何实现这一目标吗?

ps。我发现提供 false 作为第二个参数会抑制字体对话框,但 “更新图像” 对话框仍然存在。

// open file(s)
fileObj = app.open(list_of_files,false);

我一直在参考的资源 https://wwwimages2.adobe.com/content/dam/acom/en/devnet/indesign/sdk/cs6/scripting/InDesign_ScriptingGuide_JS.pdf

解决方法

禁止对话

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;