4 Replies Latest reply: Feb 29, 2012 12:44 PM by Rums RSS

    Export to PDF with modal dialogsHi, Iam

    Rums Community Member


      I am trying to export Indesign document into PDF using Javascript. When the document has a missing font or link, a warning pops up and the export command fails saying there is a modal dialog that is open. How do I disable all the warnings or close all the warning dialogs before executing my export command?


      thanks for your help.

        • 1. Re: Export to PDF with modal dialogsHi, Iam
          [Jongware] MVP

          app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;


          This will completely and utterly hide all dialogs. Be kind to your users (and to yourself!) and disable it just before a command that may pop up unwanted dialogs; then, right after that command, enable them again! Or else you will never see a Javascript error pop up, or, for that matter, any other ID dialog. It does what it says on the label!

          • 2. Re: Export to PDF with modal dialogsHi, Iam

            Hi Rums,


            I have an Applescript to do a PDF export with warnings for missing/modified links or fonts that works nicely from the script panel in InDesign.

            But I wanted to make it run form a panel. Unfortunatly teh Adobe Configurator only works with javascript.

            I have no expertise at all with javascript.

            Could I make use of your script?

            Would be very grateful.

            • 3. Re: Export to PDF with modal dialogsHi, Iam
              KuddRoww Community Member

              var myFolder = Folder.selectDialog("Select an in folder.");

              var files = myFolder.getFiles ("*.indd");

              var outFolder = Folder.selectDialog("Select an out folder.");


              for(i = 0, l = files.length; i <l; i++)


                  myFile = app.open(files[i], true)    


              myFile.exportFile(ExportFormat.PDF_TYPE, File(outFolder + "/" + myFile.name.replace(/\.indd$/,"") +".pdf"), false);



              alert("PDFs have been generated.")


              • 4. Re: Export to PDF with modal dialogsHi, Iam
                Rums Community Member

                sure kris..... here is the script that I used.



                var runScript = function (inputFilePath, pdfFilePath)



                          try {

                                    // suppress warnings, alerts

                                    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;


                                    // open input file

                                    var inFile = new File (inputFilePath);

                                    var myDocument = app.open (inFile);


                                    // export the file to pdf

                                    app.pdfExportPreferences.pageRange = PageRange.ALL_PAGES;

                                    var pdfFile = new File(pdfFilePath);

                                    myDocument.exportFile(ExportFormat.pdfType, pdfFile, false);





                                    // Close the document in InDesign



                                    app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;




                          } catch (e) {

                                    alert ("There was a problem exporting file ("+e+")");