Answered
Once the dialog box is open, is it necessary to obtain the value? How can cancellation be allowed?
Sometimes I open the dialog box, but then realize it was a mistake, so I cancel it.
At this point, I get an empty value, which causes an exception.
How can I cancel the dialog box and make it seem like nothing happened?
function makeDialog() {
var mm = 2.835;
var theDialog = app.dialogs.add({ name: "CN and CSP settings", canCancel: true, minHeight: 600, minWidth: 400, });
with (theDialog.dialogColumns.add()) {
staticTexts.add({ staticLabel: "CN:" });
staticTexts.add({ staticLabel: "SP:" });
}
with (theDialog.dialogColumns.add()) {
getCn = integerEditboxes.add({ editValue: 4 });
app.scriptPreferences.measurementUnit = MeasurementUnits.MILLIMETERS;
getCsp = measurementEditboxes.add({ editValue: (6 * mm), editUnits: MeasurementUnits.millimeters });
}
if (theDialog.show() == true) {
getCn = getCn.editContents;
getCsp = getCsp.editValue / mm;
//run a function that uses the global results
//main()
theDialog.destroy();
}
}
