0 Replies Latest reply on Mar 26, 2013 1:53 AM by peacea

    Bug - 'Save As' followed by 'Close' method

    peacea Level 1

      Hi

       

      When the following methods are called one after the other, it causes a bug in Illustrator. That is, user can no longer draw in Illustrator, unless the application is closed and restarted.

       

      Code with bug

       

      import flash.filesystem.File;

       

      Illustrator.app.activeDocument.saveAs(new File(File.desktopDirectory.nativePath + "\\test.ai"));

      Illustrator.app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

       

      Work around

       

      If a time delay is put in between the saveAs() method and the close() then the bug goes away, e.g.

       

      var myfunc = function() {

           Illustrator.app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

      }

                 

      Illustrator.app.activeDocument.saveAs(new File(File.desktopDirectory.nativePath + "\\test.ai"));

      setTimeout( myfunc, 1000 );

       

      Anybody know what causes the bug, and if there is a better workaround?