Certain actions not recording in Alchemist - Using Script Listener to get info

First, thank you to Jarda for creating Alchemist. It has been a huge lifesaver without having the finished DOM API.

This is more of an FYI to help anyone out who runs across this. There are some commands that don’t record in Alchemist but still record with script listener. The new Transformation Reset for smart object and select Subject are 2 that come to mind but I’m pretty sure I saw a couple more as well. You can still use script listener in CC 2021 still to get the command and patch up a batchPlay descriptor.

For the new CC 2021 Reset Transform, this is the Alchemist output. It stops after the “invokeCommand”.

const batchPlay = require("photoshop").action.batchPlay;

const result = await batchPlay(
[
   {
      "_obj": "invokeCommand",
      "commandID": 6347,
      "kcanDispatchWhileModal": true,
      "_isCommand": false,
      "_options": {
         "dialogOptions": "dontDisplay"
      }
   }
],{
   "synchronousExecution": false,
   "modalBehavior": "fail"
});

Here is the Script Listener output

// =======================================================
var idinvokeCommand = stringIDToTypeID( "invokeCommand" );
    var desc28 = new ActionDescriptor();
    var idcommandID = stringIDToTypeID( "commandID" );
    desc28.putInteger( idcommandID, 6347 );
    var idkcanDispatchWhileModal = stringIDToTypeID( "kcanDispatchWhileModal" );
    desc28.putBoolean( idkcanDispatchWhileModal, true );
executeAction( idinvokeCommand, desc28, DialogModes.NO );

// =======================================================
var idhistoryStateChanged = stringIDToTypeID( "historyStateChanged" );
    var desc29 = new ActionDescriptor();
    var idDocI = charIDToTypeID( "DocI" );
    desc29.putInteger( idDocI, 220 );
    var idIdnt = charIDToTypeID( "Idnt" );
    desc29.putInteger( idIdnt, 228 );
    var idNm = charIDToTypeID( "Nm  " );
    desc29.putString( idNm, """Reset Transforms""" );
    var idhasEnglish = stringIDToTypeID( "hasEnglish" );
    desc29.putBoolean( idhasEnglish, true );
executeAction( idhistoryStateChanged, desc29, DialogModes.NO );

// =======================================================
var idplacedLayerResetTransforms = stringIDToTypeID( "placedLayerResetTransforms" );
executeAction( idplacedLayerResetTransforms, undefined, DialogModes.NO );

Here is the modified Alchemist batchPlay code the works for the new CC 2021 Reset Smart Object Transform. I omitted the “dialogOptions”: “dontDisplay” part based on the prior discussion in one of my posts. I’m not even sure what “_isCommand” does but it seems it doesn’t need that either.

const batchPlay = require("photoshop").action.batchPlay;

const result = await batchPlay(
[
   {
      "_obj": "placedLayerResetTransforms"
      }
   }
],{
   "synchronousExecution": false,
   "modalBehavior": "fail"
});

Anyway, just want to post this as FYI in case it may help someone who encounters the same thing with this command or another one that the script listener may hep with.

Weird, for me it does show up in Alchemist:
image

Are you on Windows or Mac? I’m running windows.

Also, Alchemist will stop recording on my computer at times and the Alchemist reset doesn’t solve it. I need to uninstall and reinstall Alchemist and then it start recording again. It doesn’t seem to be linked to these commands though. I tried this one and Select Subject several time and those 2 always stop after “invokeCommand”. That is the only event recorded for those 2.

This is all I get for the Reset Transform. Maybe I have a setting different than you do for the recording option or something?

I figured out what was going on. I was using the PROD version. Some actions don’t record in the PROD version which was stated in the readme doc in the DEV version from github. After installing the DEV version it recorded it just fine.

Yes, that is exactly it. You can list missing event names here for the production version https://github.com/jardicc/alchemist/issues/3

Regarding that _isCommand key I learned a bit more today: When you listen to events via photoshop.action.addNotificationListener(), the specific event gets fired twice, once with _isCommand: true, once with _isCommand: false.
For example: Setting a font to bold logs one ‘set’ event in Alchemist - When I add the notificationListener for ‘set’, doing the same task logs two ‘set’ events with the differences explained above.

So I assume that these additional Descriptors are just for possible listeners to catch, while the _isCommand: true ones are for Photoshop to execute. Therefore I’d say it’s always safe to just leave that key out, since the default value seems to be true anyway. Maybe also an idea to make the generated code of Alchemist less clustered, @Jarda

I want Alchemist to show you as much truth as possible. But I think that could be good feature request for plugin settings so you could opt-in to hide that property. You can make a feature request here if you want to: https://github.com/jardicc/alchemist/issues

Just saw it’s already in my FR for the additional options :slightly_smiling_face:

Thanks for the info. I feel safer now. I’ve been omitting it from a lot of things. I was hoping it wouldn’t come back to bite me later with a Photoshop update and it would all of a sudden then be needed.