2 Replies Latest reply on Sep 16, 2013 5:01 AM by virender_CTS

    How to suppress "modal dialog or alert" when the script is in process?

    virender_CTS

      Dear all,

       

      I created a script which will place text from rtf files from a folder to an active document on different page based on match. But if a font which was in doc file but not present in my mac, showed error while running the script.

      That means Indesign opened a missing font alert box and script stop at that line and the error its shows "cannot handle the request because a modal dialog or alert is active".

       

      Is is possible to suppress this error and script continue to place all RTF files? i have little knowledge on try/catch.

       

      #target Indesign

      var myDoc = app.documents.item(0);

      var sourceFolder = Folder("/Users/admin4/Desktop/ec_txt");

      myFiles = sourceFolder.getFiles("*.rtf");

       

      var myFrame1 = myDoc.pageItems.itemByID(111076);  // switerland

      var myFrame2 = myDoc.pageItems.itemByID(111114);  // eurozone

      var myFrame3 = myDoc.pageItems.itemByID(111146);  // germany

       

       

      for (var i=0; i < myFiles.length; i++)

      {

          switch (myFiles[i].name.slice (6, myFiles[i].name.lastIndexOf("_")))

              {

              case "Switzerland_en":

              myFrame1.parentStory.insertionPoints.item(-1).place(File (sourceFolder + "/" + myFiles[i].name))

              break;

       

              case "Eurozone_en":

              myFrame2.parentStory.insertionPoints.item(-1).place(File (sourceFolder + "/" + myFiles[i].name))

              break;

       

              case "Germany_en":

              myFrame3.parentStory.insertionPoints.item(-1).place(File (sourceFolder + "/" + myFiles[i].name))

              break;

       

      }

      }