Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Alert Hello World in UXP

Engaged ,
Jan 31, 2025 Jan 31, 2025

Copy link to clipboard

Copied

Not so much jumping into the deep end but going swimming with cement flippers with UXP, I try to create an alert in InDesign .injs:

 

 

alert("hello!");

 

 

I get an alert of sorts...

GhoulFool_0-1738331259281.pngexpand image

But not quite as friendly as I'd hoped.

 

 

I can get around it by writing a bespoke alert function as mentioned in this recipe here.

 

However... it says here that Since UXP v7.4, `alert()` can only be invoked in `plugin` via the featureFlags `enableAlerts`. Update your Manifest v5 with the following:

 

so I've updated  the manifest:

 

{
  "id": "myUniqueId",
  "name": "Hello Worldplugin",
  "version": "0.0.1",
  "description": "Description goes here",
  "summary": "Summary goes here",
  "host": {
    "app": "XD",
    "minVersion": "13.0"
  },
  "uiEntryPoints": [
    {
      "type": "menu",
      "label": "Create Rectangle",
      "commandId": "createRectangle"
    }
  ],
  "featureFlags": {
     "enableAlerts": true
 }
}

 

based on the Developer Starter project - so ignore references to rectangles. But get the same error as above.

 

So what's going on?

 

TOPICS
UXP Scripting

Views

119
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 01, 2025 Feb 01, 2025

Copy link to clipboard

Copied

you may also want to post your question here:

https://forums.creativeclouddeveloper.com/

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 02, 2025 Feb 02, 2025

Copy link to clipboard

Copied

"host": {
  "app": "IDSN",
  "minVersion": "19.0"
}

 

If it's still not working

 

async function showCustomAlert() {
    const modal = document.createElement("dialog");
    modal.innerHTML = `
        <form method="dialog">
            <p>Hello!</p>
            <button>OK</button>
        </form>
    `;
    document.body.appendChild(modal);
    modal.showModal();
}
showCustomAlert();

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Feb 04, 2025 Feb 04, 2025

Copy link to clipboard

Copied

LATEST

The modification to the manifest came up with the same error as before. Whilst the showCustomAlert - did nothing. Double click the script and no response - presumably it compile and ran ok, but didn't add anything to the screen alertwise.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines