8
Script using uxp module crashes in Developer Tool, but not without
Community Beginner
,
/t5/indesign-discussions/script-using-uxp-module-crashes-in-developer-tool-but-not-without/td-p/13864469
Jun 14, 2023
Jun 14, 2023
Copy link to clipboard
Copied
The following script runs fine when launched from the Scripts Panel, but when run in the UXP Developer Tool, it gives this error message: "Cannot read properties of undefined (reading 'on')".
const versionInfo = await getVersion();
alert(versionInfo);
function alert(msg) {
const theDialog = app.dialogs.add(),
col = theDialog.dialogColumns.add();
msg.split('\n').forEach(line => {
const colText = col.staticTexts.add();
colText.staticLabel = line;
});
theDialog.canCancel = false;
theDialog.show();
theDialog.destroy();
}
async function getVersion() {
const versions = require('uxp').versions;
const host = require('uxp').host;
return `Host: ${host.name} ${host.version} ${host.uiLocale}\nUXP: ${versions.uxp}`;
}
Stepping through, require('uxp').host is the offending command.
Using InDesign 18.3 with UXP 6.5.0
TOPICS
Scripting
,
UXP Scripting
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more
Community Expert
,
LATEST
/t5/indesign-discussions/script-using-uxp-module-crashes-in-developer-tool-but-not-without/m-p/13901685#M532020
Jun 29, 2023
Jun 29, 2023
Copy link to clipboard
Copied
My experiments with UXP indicate that it is an unfinished product feature and cannot be relied upon yet.
Mike Witherell
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting.
Learn more

