In Illustrator I am trying to detext if a placed item has a file, or if a file path is broken.
Usually I would check it like this:
for (var i = 0; i < placedItems.length; i++){
alert(placedItems[i].file.exists)
}
The alert should return a boolean value, true or false. But instead I get an error for the items that have no file:
Error 9062: There is no file associated with this item
So how can I check if a file exists, or not than?
You could use a try catch block within your loop
try {
// everything went fine
}catch(e){
$.writeln(e);
// do something with the error
}