Skip to main content
Omachi
Legend
October 25, 2022
Answered

Unable to get Enumerator correctly in UXP Scripting

  • October 25, 2022
  • 2 replies
  • 826 views

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.

This topic has been closed for replies.
Correct answer Laubender

Hi @Omachi ,

UXP is a work in progress.

The number is currently not implemented with enumerators.

Also see a discussion about this at InDesign Prerelease.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

2 replies

LaubenderCommunity ExpertCorrect answer
Community Expert
October 25, 2022

Hi @Omachi ,

UXP is a work in progress.

The number is currently not implemented with enumerators.

Also see a discussion about this at InDesign Prerelease.

 

Regards,
Uwe Laubender
( Adobe Community Expert )

Omachi
OmachiAuthor
Legend
October 25, 2022

Laubender, thank you.
I was able to find a relevant description in the prerelease.

Community Expert
October 25, 2022

Hi @Omachi,

Please post the bug at the following link

https://forums.creativeclouddeveloper.com

Edit:- I gave the wrong link previously. That was about the UXP documentation project.

-Manan

-Manan
Omachi
OmachiAuthor
Legend
October 25, 2022

Thank you. I tried.