在InDesign CC JavaScript中显示进度条时防止对话框和警报
我的脚本分析了一堆InDesign文件。任何关于缺少字体等的警告都是无关的,因此我在核心工作期间关闭用户交互:在InDesign CC JavaScript中显示进度条时防止对话框和警报,javascript,adobe-indesign,Javascript,Adobe Indesign,我的脚本分析了一堆InDesign文件。任何关于缺少字体等的警告都是无关的,因此我在核心工作期间关闭用户交互: // preparation code app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT; // core work code app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERA
// preparation code
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
// core work code
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.INTERACT_WITH_ALL;
// finish code
然而,我想显示一个进度条。我已经用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;
}
}
progressPanel=newprogresspanel(files.length,500);
progressPanel.show();
对于(i=0;i
这在InDesign CS 6中运行良好。但不是在CC 2015中,除非我删除所有NEVER_INTERACT语句
在InDesign CS 6和更高版本中,如何在抑制其他用户交互的同时显示进度条?至少对于InDesign CC 2017,调用win.update()就可以了!(有关ID CC中调色板窗口的更多信息,请参见Adobe论坛。)
哦。看起来Adobe弄坏了什么东西。(再次)您可以使用
app.version
检查脚本运行的版本,然后根据该版本抑制警报或不抑制警报。我认为不可能仅抑制一个选择。为什么不将已解决的部分移动到新答案?
this.show = function() {
this.win.show();
this.win.update();
}
this.incr = function() {
var inc = arguments.length ? arguments[0] : 1;
this.value += inc;
this.myProgressBar.value = this.value;
this.win.update();
}