5 Replies Latest reply on Jun 8, 2012 5:43 AM by B4stien

    Can't modify document metadata when a dialog is open

    B4stien Level 1

      Hi everyone,

       

      I'm getting an error : Cannot handle the request because a modal dialog or alert is active. Whenever I try to modify the document metadata and a dialog window is open.

       

      I've set my extension to not be interrupted by dialogs, with UserInteractionLevels.neverInteract:

       

      public static function run():void

        {

          var app:com.adobe.indesign.Application = InDesign.app;

          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

          // ...

        }


       

      Nonetheless, when I try to save meta data on the document, if a dialog is open, this code fails:

       

      public class Metadata

      {

         public static function itemDownloaded(document:com.adobe.indesign.Document, dataXML:XML)

           {

            // ...

            document.metadataPreferences.setProperty("http://mydomain.com", 'data', dataXML);

           }

        }

       

       

      Here is the place where the metadata code is invoked, it is triggered when a file has been downloaded:

       

      public class FileDownloader

        {


         // ...


         public function onComplete(completedFile:File):void

           {

             var app:Application = InDesign.app;

             Metadata.itemDownloaded(app.activeDocument, downloadInfoXML());

             // ...

           }

        }

       

      Is there a way to go around it? Any suggestions?

      Thanks in advance for your help.

       

      - Bastien