Prevent dialogs and alerts while showing a progress bar in InDesign CC JavaScript
<p>My script analyses a bunch of InDesign files. Any warnings about missing fonts etc are irrelevant, thus I turn off user interaction during the core work:</p>

<pre><code>// preparation code
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
// core work code
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
// finish code
</code></pre>

<p>Nevertheless I want to show a progress bar. I've set this up with ScriptUI:</p>

<pre><code>progressPanel = new ProgressPanel(files.length, 500);
progressPanel.show();

for (i = 0; i &lt; files.length; i++) {
    processFile( files[i] );
    progressPanel.incr();
    progressPanel.setText( files[i].name );
    progressPanel.show();
}

// Progress Panel, inspired from:
// http://wwwimages.adobe.com/content/dam/Adobe/en/devnet/indesign/sdk/cs6/scripting/InDesign_ScriptingGuide_JS.pdf
// We make it a class.
function ProgressPanel (myMaximumValue, myProgressBarWidth){
    this.myProgressPanel = new Window('window', 'analyse InDesign files…');
    this.value = 0;

    this.myProgressPanel.myProgressBar
        = this.myProgressPanel.add('progressbar', 
                                 [12, 12, myProgressBarWidth, 24], 
                                    0, myMaximumValue);
    this.myProgressPanel.myText
        = this.myProgressPanel.add("statictext", 
                                   [15, 6, myProgressBarWidth, 24]);    
    this.show = function() {
        this.myProgressPanel.show();
    }
    this.hide = function() {
        this.myProgressPanel.hide();
    }
    this.setValue = function(value) {
        this.value = value;
        this.myProgressPanel.myProgressBar.value = value;
    }
    this.incr = function() {
        var inc = arguments.length ? arguments[0] : 1;
        this.value += inc;
        this.myProgressPanel.myProgressBar.value = this.value;
    }
    this.setText = function(text) {
        this.myProgressPanel.myText.text = text;
    }
}
</code></pre>

<p>This works fine in InDesign CS 6. But not in CC 2015, unless I remove all NEVER_INTERACT statements.</p>

<p>How can I show my progress bar while suppressing other user interaction, in both InDesign CS 6 and later?</p>