This content has been marked as final. Show 3 replies
Use try...catch, like this:
Ole is right.
In my humble opinion, it's a weird project to close your program if the file is not found. Don't you want to keep working on indesign afterall ?
try/catch is a intersting technique to get info when you face a boring bug. But for that simple instruction,you can choose to do that :
var myfile = File("~/Desktop/minu/Amit-TOC.indd");
/* you may not want to be warned for the non presence of the file
alert("Sorry, the file may have been displaced or removed !")
// Or better
// File.openDialog("Pick a file please...");
Thank you ole and loic.
I will try to use both method in my script.