Using UXP instead of a single javascript

Hi everyone,
I have a pretty general question. But first a little background.

My team and I use a javascript file that a former colleague made for us, a few years back, to automate specific and repititous operations in photoshop. Mainly placing RAW files in specific generated artboards and applying a mask from another file to that raw file and creating a smart object out of everything. Then creating new text layers from a master text layer by splitting it up and creating a headline and subline according to a template in that photoshop file as well as creating translations using that master text layer (creating a new artboard for each translation). And then finally exporting the artboards as images into the language specific folders.

Now for my question the script has some problems with the newest photoshop versions and we were deliberating creating a new one and I thought that we could maybe create a plugin using UXP to handle those tasks. Do you think this would be a viable task for a UXP plugin?

Thanks for reading this far and have a great day

Probably…? Hard to say for sure w/o knowing more details. Either way, you should check out Jarda’s Alchemist plugin and use it to record batchPlay descriptors as you do some of those steps manually. Then you can take that code and refine it into something you can execute programmatically.

But this more magic than science… so here there be dragons.

Is there a lot of logic going on w/ this? I’m wondering if you could accomplish this with Actions instead?

Logic wise the script currently uses the naming scheme of the raw images to populate the different artboards and also names them accordingly. We mostly do product image retouching and it names the artboards after the SKU of the product and also takes the order of the artboards from those raw filenames as well.

So for example the SKU of the product would be 12345 and we want to end up with 5 images the naming of the raw files would be “12345_1_01”/12345_2_01"/12345_3_01"/… The first part is the SKU the number after the first underscore indicates which image it should be (1-5) and the last part after the second underscore is a differentiating variable if there are more than one image per artboard.

I’ve already tinkered with the ALchemist plugin a bit but my knowledge isn’t at a level yet where I can manipulate the code afterwards to get to desired end goal. I’ve also found the book of Davide Barranca and was wondering if that could help me get to that level.

But maybe it would be easier and quicker to just change up our current script and fix the bugs that we are currently experiencing.

Thanks for the input.

Hi @Stephan_Leo,
a few points that may clarify the situation and hopefully help you make a choice.

  • If your script doesn’t have a user interface, you don’t necessarily need a UXP plugin, but a standalone Photoshop script. Problem is that standalone scripts using the new JS engine are not available at the moment (they’re close in the roadmap though, according to this).
  • My UXP/React course focuses more on the UXP API than the Photoshop API; I definitely make use of the latter, but the core is on the UXP API (and React of course). For what I understand, you’re more in need of scripting help. I’ve also written Professional Photoshop Scripting, but it is based the old ExtendScript/JSX engine. I definitely plan a second edition, completely rewritten for the new “modern” JS engine, but I need the PS DOM to be at least near completion to start working on it.
  • My understanding, but you should ask for more official confirmations here, is that the JSX engine will be kept around for quite some time (for compatibility purposes), so costs-wise it could be preferable to fix the old script rather than rebuild it from scratch now. What is now known as BatchPlay in UXP exists in the ExtendScript realm as ActionManager (AM is the BP precursor: same exact concept, different syntax), and this is definitely covered in the Pro PS Scripting book. Only thing you should pay attention to is the tooling: the book’s based on the ExtendScript ToolKit, that doesn’t work anymore with modern macOSes, now there’s a VSCode plugin (I’ve linked version 1.x, there’s a more powerful v2 that is in the release-candidate stage)

I hope this helps!

Thank you very much for the clarification. I think the best way to go forward for us would be a reworking of our existing script, as you said. I’ll talk abaout it with my team and we’ll see what we can do in that regard.

Thanks again