我刚刚完成了一个Adobe InDesign CS6的ExtendScript项目。我需要消除的最后几个bug之一是以下错误消息的形式:
无法处理请求,因为模式对话框或警报处于活动状态
脚本中发生的事情是,它打开一个InDesign文件,对它做一些工作,然后保存并关闭它。但是,如果文件中的某些文本使用了我的系统中未安装的字体,则会弹出一个窗口,提醒我这一点。由于此弹出窗口,整个脚本被中断并错误地显示上述消息。
有没有办法让脚本来处理这个问题?也许是为了留意弹出窗口,然后在继续脚本的其余部分之前将其关闭(相当于在窗口上单击"OK“)?
发布于 2013-06-26 02:25:40
试试这个:
var oldUserInteractionLevel = app.scriptPreferences.userInteractionLevel;
app.scriptPreferences.userInteractionLevel = UserInteractionLevels.NEVER_INTERACT;
// Put code here that would create the alert.
// E.g. If the alert is caused by opening the document, then open the document here.
app.scriptPreferences.userInteractionLevel = oldUserInteractionLevel;
// After this line you can safely show dialogues to the user.
https://stackoverflow.com/questions/17304159
复制相似问题