查看当前文档是否保存

Check if the current document is saved

我只是想知道是否有 javascript 可以 check/detect 如果当前文档已经保存或更新。

我在网上搜索过,但一无所获。


编辑: 如果在 Illustrator 中打开的活动文档有未保存的更改,我希望有一个警告,指示文档尚未保存。

titled: Adobe Illustrator CC 2017 Scripting Reference: JavaScript 的第 38 页上指出 Document 对象有一个 saved 属性.

说明如下:

Property : saved
Value Type : boolean
Description : If true, the document has not been changed since the last time it was saved.

因此您可以执行以下操作:

if (!app.activeDocument.saved) {
  alert("The document has changed since the last time it was saved", 'Unsaved Changes', true)
}

如果 saved 属性 是 false,示例代码(上面)会提醒用户。