Stu*_*urm 3 javascript error-handling dialog modal-dialog extendscript
我刚刚完成了 Adobe InDesign CS6 的 ExtendScript 项目。我需要解决的最后几个错误之一以以下错误消息的形式出现:
无法处理请求,因为模态对话框或警报处于活动状态
脚本中发生的事情是它打开一个 InDesign 文件,对其进行一些操作,然后保存并关闭它。但是,如果文件中的某些文本使用了我的系统上未安装的字体,则会弹出一个窗口,提醒我注意这一事实。由于此弹出窗口,整个脚本被中断并出现上述消息的错误。
脚本有没有办法处理这个问题?也许要留意一个弹出窗口并在它继续执行脚本的其余部分之前将其关闭(通过在窗口上单击“确定”的等效操作)?
尝试这个:
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.
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
4812 次 |
| 最近记录: |