3 Replies Latest reply on Sep 10, 2008 10:59 AM by Harbs.

    Problem with modal dialog

      I am using CS3 and have written a script using JS. I am batch processing a large number of files. Each file gets opened, has some changes made to the fonts, and then saved and closed. Because I do not have all the fonts on my machine, the warning comes up at the beginning telling me this. I want the script to ignore it, so I have set the preferences to never interact.

      app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

      For most of the files it works fine. Every now and then, however, the script will halt with an error telling me that it cannot proceed because a modal dialog is open. For some reason, it usually happens on the third file in the batch to be processed. Other times I can batch process the entire folder without incident.

      Can someone explain why it is not ignoring those dialogs? Do I need to add a pause so the script will wait at some point for the dialog to close?
        • 1. Re: Problem with modal dialog
          Level 1
          Hi kwilson68,

          Could you post the part of your script that iterates through the documents? I'm guessing that the problem lies somewhere there, and not with the user interaction level.


          • 2. Re: Problem with modal dialog
            Level 1
            Here is the majority of the script:

            // Set the source file from which styles will be imported
            var styleSource = new File ("/c/styles.indd");

            // Have user select folder to process
            var targetFodler = new Folder();
            targetFolder = Folder.selectDialog();

            // Set the array for all the files in the selected folder
            var targetFiles = new Array();
            targetFiles = targetFolder.getFiles("*.indd");

            // Open each file in turn
            var numberOfFiles = targetFiles.length;

            for (var i = 0; i < numberOfFiles; i++) {

            var currentDocument = app.open(File(targetFiles[i]));

            // Import styles
            if (styleSource.exists) {
            app.activeDocument.importStyles(ImportFormat.textStylesFormat, styleSource, GlobalClashResolutionStrategy.loadAllWithOverwrite);

            • 3. Re: Problem with modal dialog
              Harbs. Level 6
              I'm not sure if this has to do with your problem, but "var targetFodler"
              should have been "var targetFolder"...