Asked • 03/27/19

Prevent dialogs and alerts while showing a progress bar in InDesign CC JavaScript?

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: // preparation code app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT; // core work code app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL; // finish code Nevertheless I want to show a progress bar. I've set this up with ScriptUI: progressPanel = new ProgressPanel(files.length, 500); progressPanel.show(); for (i = 0; i < 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; } } This works fine in InDesign CS 6. But not in CC 2015, unless I remove all NEVER_INTERACT statements. How can I show my progress bar while suppressing other user interaction, in both InDesign CS 6 and later?

1 Expert Answer

By:

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.