Can i run javascript.jsx file using UXP button

This unfortunately does not work anymore for the new DOM API Version 2. What do we have to change to make it work with the DOM API Version 2?

I don’t think you can make it work. From what I can tell, UXP no longer supports running old JSX scripts at all. Even if you try to play an action through UXP where the action runs a JSX script, that will not work either. So the only option is to recreate the script in UXP.

JSX is deprecated and is on the way out eventually. I think this is just part of the JSX phase out process.

I agree but for me Export is not available and textItem is still not available.

do we even have a batchplay script that can export to a specific file lname and location?

nothing AFAIK, this is intentional to discourage devs from relaying on JSX and for “security” reasons. I wouldn’t mind that change if UXP was more complete and stable. but we can only adapt at this point.

I can’t quickly find now who suggested this, but I think it was somewhere here in the forum :slight_smile:

You could try a workaround (which still worked in July on Ps v23.4.1, but keep in mind, if it will work now, it might stop at any time in the future):

  • Create an action, that executes your JSX script (lets name it “Action 1”)
  • Create an action, that plays previously created “Action 1” (lets name it “Action 2”)
  • Run “Action 2” from UXP

So basically you should run an action, which plays another action, which has a JSX script :smiley: I assume Adobe somehow overlooked it and this will be fixed (if not yet) at some point.

LOL… nested actions for a work around.

I think Adobe has been clear enough that they don’t want JSX being ran from UXP.

As far as I’m concerned, JSX is an ancient fossil buried in the CS6 sediment layer. I have no desire to dig up the bones.

If anybody finds a solution (that is to say, something that hasn’t been guard-railed by Adobe yet), they better not post it here but keep it secret instead :grin:
Old JSX’s fate is sealed :wine_glass:

2 Likes

Have you changed the modal behaviour? Otherwise delete that line - still works for me API 2

I’m trying to get this script to work,
i created a folder with name jsx in the panel folder
and inside I put a file named script1.jsx
but it does not work,

can anyone see whats wrong and where i went wrong?

this is the script

async function test1() {

 await ScriptRun(script)
     var script = "jsx/script1.jsx" 

const app = window.require("photoshop").app;
const { entrypoints } = require("uxp");
const batchPlay = require("photoshop").action.batchPlay;
const fs = require("uxp").storage.localFileSystem;

async function ScriptRun(jsxFile) {

   let pluginFolder = await fs.getPluginFolder()

   try {
      let jsxFileObject = await pluginFolder.getEntry(jsxFile);
      var filetoken = await fs.createSessionToken(jsxFileObject);
   } catch (e) {
      app.showAlert("No Script");
   }
   return await batchPlay(
      [
         {
            "_obj": "AdobeScriptAutomation Scripts",
            "javaScript": {
               "_path": filetoken,
               "_kind": "local"
            },
            "javaScriptMessage": "JSM",
            "_isCommand": true,
            "_options": {
               "dialogOptions": "dontDisplay"
            }
         }
      ], {
      "synchronousExecution": false,
      "modalBehavior": "fail"
   });
}

As Davide suggested… Adobe does its best to not make JSX execution from UXP possible.

Jarda
unfortunately I have many jsx scripts and reviewing them all in uxp will be torture,
i’m not quite ready to embrace uxp.

Is there a solution to my problem right now?

There are some tools to convert action manager code into batchPlay. There is also new DOM that somewhat tries to be similar to old ExtendScript DOM. But nothing automatic so far.

Did you try my suggestion? Or doesn’t it work any more? In any case, sooner or later you will have to move to UXP

Excuse me I have tried the above suggestions but they don’t work. I put my example above, what’s wrong? I know we’ll switch to uxp but right now I don’t have much time to study all the documentation.

I have no idea what you’re saying. This is English speaking forum