Can Alchemist capture events triggered by Extended Script in JSX file? How?

I have just started playing with Alchemist, what a great tool to capture Photoshop events, provide batchPlay code and inspect DOM. One thing I haven’t figured out yet how to capture the events generated by running extended script. E.g. I have a test.jsx file with the following code:

    var layers = app.activeDocument.artLayers;
    var layer = layers.add();
    layer.kind = LayerKind.TEXT;
    layer.name = "MyTextLayer";

this creates an empty layer of type TEXT. If I run this script from Adobe’s ExtendScriptToolkit Alchemist doesn’t capture anything. If I run the script from Photoshop->Scripts, Alchemist captures the fact that the jsx file was run, but not the details of each command within that script. Here’s what Alchemist captures:

{
   "_obj": "AdobeScriptAutomation Scripts",
   "javaScript": {
      "_path": "D:\\Documents\\Adobe Scripts\\test.jsx",
      "_kind": "local"
   },
   "javaScriptMessage": "undefined",
   "_isCommand": true
}

Is there a way to capture the individual events within my jsx script file so that I could get Alchemist show something along these lines:

{
            "_obj": "make",
            "_target":
            [
                {
                    "_ref":"layer"
                }
            ],
            "using":
            {
                "_obj": "layer",
                "name": "MyTextLayer",
                "layerKind": 3
            },
            "_isCommand": true,
            "_options":
            {
                "dialogOptions": "dontDisplay"
            }
        }

Note, the descriptor code above successfully creates a layer, just not a text layer - something I’m trying to solve via another thread on this forum.

Ultimately I’m trying to figure out if there’s an easy way to translate some of my old extended script jsx files to batchPlay scripts by simply replaying them (or snippets of them) and observing the new json format for batchPlay.

Thank you.

It could work if you will use Marketplace version. But I do not have complete list of events and in my computer (windows) sometimes it does not listen events at all. Listener that we have for development only… cannot listen events of others.

Thank you, I’ll give that a try.

So I tried using the Marketplace version, but got the same results as using the developer version.

I don’t think that what you’re trying to achieve is possible. Running a script does not throw all the occurring events onto the “event pipeline” (where Alchemist or Photoshop Actions listen, I’m lacking a better word), instead it all gets bundled to one event.

For example, when you run the “delete all empty layers” script while recording an action, it only shows the following result:
image

In Alchemist its kind of the same but with the scripts uuid:

{
      "_obj": "a0754df2-9c60-4b64-a940-6a2bb1102652",
      "_target": [
         {
            "_ref": "document",
            "_enum": "ordinal",
            "_value": "targetEnum"
         }
      ],
 }

What you probably would like to have is something like:

> select layer
> delete layer
> select layer
> delete layer
> …

but these individual steps aren’t loggable as it seems

One thing you can do eventually, is use UXP to call a jsx from the PS menu “File > Script”. Note that any JSX file you want to call using that solution has to be present in the PS file structure, on your hard drive, where PS Scripts files should live.

Note that this could be recorded as an action too, as this Script menu is part of PS, by the way.

However, listening to the called steps withing this jsx file using Alchemist won’t give you much details rather than what @simonhenke described… (I performed my tests on Mac and Win10, using Alchemist Marketplace and GitHub version. I use the later pretty much all the time.)

1 Like

ah you are right now I see it. In the end, I did not use a “universal” boolean flag to listen event no matter what triggered it. alchemist/Listener.ts at b2549fe1477911705a440d076410019e34686126 · jardicc/alchemist · GitHub