1

在 Illustrator 中,如果放置的项目有文件,或者文件路径是否损坏,我会尝试去文本化。

通常我会这样检查:

for (var i = 0; i < placedItems.length; i++){
alert(placedItems[i].file.exists)
}

警报应该返回一个布尔值,true 或 false。但是,对于没有文件的项目,我得到了一个错误:

错误 9062:没有与此项目关联的文件

那么如何检查文件是否存在?

4

1 回答 1

1

您可以在循环中使用 try catch 块

try {
// everything went fine 
}catch(e){
$.writeln(e);
// do something with the error
}
于 2016-01-27T04:47:51.670 回答