对于那些熟悉 ExtendScript 和 InDesign 的人,我有一个 ScriptUI 问题:当按钮是自定义选项时,如何在用户选择一个按钮或另一个按钮后正确关闭窗口。请看下面的代码:
$.writeln("The user pressed " + chooseOyo("123456"));
function chooseOyo(jobNumber) {
var machine;
var getOyoWindow = new Window ("dialog", "Which Imagesetter?");
var textGroup = getOyoWindow.add("group");
textGroup.orientation = "column";
textGroup.add("statictext", undefined, "The current job is " + jobNumber);
textGroup.add("statictext", undefined, "Please choose an imagesetter for this job:");
var buttonGroup = getOyoWindow.add("group");
var o1 = buttonGroup.add("button", undefined, "OYO 1");
var o2 = buttonGroup.add("button", undefined, "OYO 2");
o1.onClick = function () {machine = "OYO1";}
o2.onClick = function () {machine = "OYO2";}
if (getOyoWindow.show() == 1) {
return machine;
} else {
exit();
}
}
相当简单,不是吗?好吧,到目前为止,按钮没有做任何事情,您必须按 [ESC] 才能取消窗口。我怎样才能让它工作?