Skip to main content
Inspiring
July 8, 2011
Question

importing a corrupted file

  • July 8, 2011
  • 1 reply
  • 636 views

I have a script that is auto importing files.  If it tries to import a file that is corrupted, the script silently exits.  Is there a way to test if a file is corrupted; I tried

     replace = app.project.importFile(new ImportOptions(file));

     if(!replace){

          alert('noCanDo');

     }

but it never gets to the block because the script immediately exits  on app.project.importFile

any ideas on how I can accomplish this?

This topic has been closed for replies.

1 reply

Inspiring
July 8, 2011

Try this:

try {

     replace = app.project.importFile(new ImportOptions(file));

} catch (e) {

          alert('noCanDo');

}

I'm not 100% sure if it would work since I'm not at a computer with AE, but give it a try.

regards

//Ludde

Inspiring
July 8, 2011

Awesome!  always wondered what the hell try/catch was for.  Thanks!