UXP tool doesnt work on MacOS devices

I created a tool that combines UXP and extendScript on PhotoShop. With the panel I created on UXP, I connected extendScript-based scripts via actions.

All functions work smoothly on Windows devices as expected.

On macOS devices (for both Apple silicon and Intel), while the extendScript functions continue their operations, the progress window freezes and shows it as if it is constantly processing. The strange thing is that if I execute the extendScript codes externally (without the integrated UXP plugin). My ExtendScript codes run smoothly on MacOS devices as well as on Windows.

Here I am trying to understand the main source of the problem. Because all UXP does here is run action. Why do I have problems when I execute extendScript-based codes via UXP, but when I run it manually, it works without any problems? I would appreciate every answer and help on this issue.

I am using UXP version of 2.0.1

Hi @dogukanJD,

What you’re talking about doesn’t sound completely unexpected - Photoshop chose not to keep supporting CEP on Mac M1 architecture and above. However, ExtendScript is still supported.

It’s handy if you can give a minimal code example that triggers the kind of failure you’re describing.

Hi,

You can see how I triggered ExtendScript actions through the interface I prepared on the UXP side using this link.

The reason I used UXP was to create a dockable panel and consolidate all my ExtendScript functions there.
Later on, with UXP buttons (using actions), I trigger the ExtendScript functions.
Frankly, all UXP does is trigger the actions.


This is the panel that i have prepared on UXP


Here is the example actions for invoking extendScript scripts.


Here is the example extendScript-based dialog window. That is invoked by UXP button by using actions.

Actually, there isn’t any specific code that triggers this situation because, as I mentioned earlier, if I run the same ExtendScript-based code in Photoshop through “File>Scripts>EXTENDSCRIPT_NAME” my methods work flawlessly on a Mac. However, when I run the same ExtendScript method through UXP using a button and then perform operations, I encounter this issue on Mac.

(Both cases ultimately run the same code, but one works while the other doesn’t. I’m puzzled by this because there shouldn’t be any apparent issues.)


You can see the problem I encounter when running methods through UXP here on macOS. (t gets stuck in PS as in the picture and doesn’t complete the process. I cant click on the cancel button as well.)

Lastly, PS version i am testing on Mac is v25.3.1

@Erin_Finnegan

After conducting a detailed code review on my Mac, I’ve identified the part that causes this error.

The tool is generally used to generate end cards for specified networks, and the issue only occurs with the ‘minegral’ network. Mintegral, unlike other networks, includes a ‘disclaimer’, which results in an extra method being invoked during the process. Below, I am sharing the problem that is additionally called for this specific situation and causing the bug

function setDisclaimerType(geo)
{
   if(!mintegralCheckBox.value) return;

   var disclaimerLayer = getDisclaimerLayer();
// Error occurs right in the setDisclaimerLanguageType() method
   setDisclaimerLanguageType(geo,disclaimerLayer);

   disclaimerLayer = getDisclaimer320x50Layer();
   setDisclaimerLanguageType(geo,disclaimerLayer);

   disclaimerLayer = getDisclaimer640x120Layer();
   setDisclaimerLanguageType(geo,disclaimerLayer);
}

The error is occurring specifically at the setDisclaimerLanguageType(geo, disclaimerLayer) line. There doesn’t appear to be any issues with the geo and disclaimerLayer parameters; they are being passed to the method as intended.

function setDisclaimerLanguageType(geo,disclaimerLayer)
{
// Error occurs in openSmartObject(disclaimerLayer) method
   openSmartObject(disclaimerLayer);

   var targetBadgeName = "disclaimer_";

   targetBadgeName += geo;

   var isBadgeFound = false;

   for(var i=0; i< app.activeDocument.layers.length;i++)
   {

       var targetLayer = app.activeDocument.layers[i];

       targetLayer.visible = (targetLayer.name === targetBadgeName);

       if(targetLayer.name === targetBadgeName) isBadgeFound = true;
   }

   if(!isBadgeFound)
   {
       var defaultBadge = findLayerByName("disclaimer_US");
       defaultBadge.visible = true;
   }

   closeAndSaveSmartObject();
}

The source of the error is coming from the line ‘openSmartObject(disclaimerLayer);’. This method is responsible for opening the smart object and activating the layer related to the target language required for setting the disclaimer.

function openSmartObject(targetLayer)
{
   var doc = app.activeDocument;
   doc.activeLayer = targetLayer;
   app.activeDocument.suspendHistory("Edit Smart Object", "editSmartObject()");
}

function editSmartObject() {
   var desc = new ActionDescriptor();
   var ref = new ActionReference();
   ref.putEnumerated(charIDToTypeID('Lyr '), charIDToTypeID('Ordn'), >charIDToTypeID('Trgt'));
   desc.putReference(charIDToTypeID('null'), ref);
   executeAction(stringIDToTypeID('placedLayerEditContents'), desc, >DialogModes.NO);
}

function closeAndSaveSmartObject()
{
   app.activeDocument.save();
   app.activeDocument.close(SaveOptions.SAVECHANGES);
}

Here, you can find the methods for opening and closing the Smart Object that is targeted.

The strange part is that I use the same methods to set up the ‘GooglePlayBadge’ Smart Object for other networks, and I don’t encounter any issues. The exact same methods work perfectly for the GooglePlayBadge used for all network options, both on Windows and macOS. However, it’s only the ‘Disclaimer’ used for a single network that doesn’t work on macOS. What do you think could be the reason for this?

The strangest part of and the reminder is this: I still don’t think there is any problem with the extendScript code directly. If you run the same extendScript-based script from “File>Script>EXTENDSCRIPT_NAME”, the code works flawlessly on Mac as well.

If there is anything that is unclear and you need more information, please let me know. And thank you for replying my question! ^^

@Erin_Finnegan

This answer is much more complicated than I anticipated :sweat_smile:

At the very least, it doesn’t sound like a problem with the UXP tool like your subject line indicates (we call the UXP tool “UDT”, the “UXP Developer Tool”).

I’m more than a little confused by the use of different networks in your tool… Is Minegral an advertising service?

Hi again, I’m sorry for the confusion, but I thought it would be easiest to explain this way :sweat_smile: (the problem itself is strange and complicated as well sooo)

I don’t think the problem is directly related to UXP. However, it feels like the issue arises when the scripting runs externally and doesn’t work when triggered through UXP.

Yes, Mintegral is an advertising service, and yes, I’m using different network names because the tool is used to generate smart objects for end card elements and create artboard sizes, that are specific to different networks. But the only difference in Mintegral, as I mentioned, is adding an element called “disclaimer”.