Answered
Unable to get Enumerator correctly in UXP Scripting
I wrote the following code. This works with both UXPScript and ExtendScript.
var doc = app.documents.add();
doc.documentPreferences.pageOrientation = 2003395685; //PageOrientation.LANDSCAPE
if (doc.documentPreferences.pageOrientation === 2003395685 &&
doc.documentPreferences.pageOrientation === PageOrientation.LANDSCAPE) {
alert("OK");
} else if (doc.documentPreferences.pageOrientation == "LANDSCAPE") {
alert("No!");
} else {
alert("What?");
}
function alert(error) {
var theDialog, theDialogCol;
theDialog = app.dialogs.add();
theDialog.canCancel = false;
theDialogCol = theDialog.dialogColumns.add();
theDialogCol.staticTexts.add({staticLabel: "" + error});
theDialog.show();
theDialog.destroy();
}
ExtendScript hits the first condition, but UXPScripting does not. So I created a second condition, which is rather inconvenient. Hope it gets fixed.
