Pixnub Home Page Forums Other Topics Latest Photoshop DOM? Reply To: Latest Photoshop DOM?


    You can record that into an action if you want.  I’ve already tested that and the action will work. Also,  a UXP command can be made from the action.  Running from an action with a hot key is probably the easiest.

    However, if you need it in a script…..

    JSX Extendscript is officially deprecated and Adobe isn’t updating it and will remove it eventually.  So probably the only way in Extendscript is by using the script listener, not through DOM.

    UXP (.PSJS script) is the new scripting engine.  In the case of UXP, the DOM is only partially finished and I highly doubt any preferences can be updated through the DOM.  If it can be done in the DOM the it is probably a secret and not documented anywhere.

    The vast majority of UXP scripting is done through batchPlay which is similar to JSX script listener.  You record command and then can edit and manipulate the commands.  UXP isn’t for the feint of heart.  Most programmers are still using batchPlay exclusively and not the DOM at all, myself included.  Adobe has been adding things to the DOM….. but there were some bugs in the initial release and the DOM changed significantly from one version to the next.  So as far as I’m concerned, the DOM doesn’t even exist in UXP and I won’t even use it.

    The only reliable way to write and scripting that you don’t want to break in UXP is through batchPlay.  In fact, a couple of well known programmers are so frustrated with it that they are creating their own full featured “DOM” through batchPlay that they plan to release to everyone for free.  To say the ball got dropped on the UXP DOM at the corporate level would be a vast understatement.

    So to make a script, the easiest way is to first record an action to change the preference. Then in Cc 2022 (not CC 2023), there will be an export to javascript option from the actions panel.  That will give you a useable bacthPlay script command.  Just know that this javascript is NOT JSX and won;t run from a JSX script. It is UXP and can be run from a .PSJS file which is the new script format thgat is repalcing JSX.

    Adobe removed the cool new copy as javascript option in CC 2023.  In CC 2023, or any other PS version, You can use control+alt+shift and export the action set. This will save it as a file called Actions.jon instead of an .atn file. In the JSON file, there will be a bunch of JSON descriptors which is what actions use.  Those same descriptors can be made into commands for UXP batchPlay…. but not overly intuitive how to do it.  SO I would recommend CC 2022 with the Save as Javascript option.

    There is also a plugin called Alchemist that can record UXP and also be used to create get/set descriptors for many properties.  Just don’t use the Alchemist version on the Adobe Exchange.  Adobe made the developer disable a lot of features from being recorded (not sure why).  Therefore the developer released a version on GitHub which records everything, even the stuff Adobe made him remove from the Adobe Exchange version. Alchemist is what nearly all UXP plugin developers are using to create commands instead of using the DOM.

    So the bottom line here is the new Photoshop scripting engine isn’t for the feint of heart…… so if you dive into this rabbit hole just a heads up that you may find a Cheshire Cat and some Singing/Dancing playing cards.


    • This reply was modified 1 year, 7 months ago by Pixnub.
    • This reply was modified 1 year, 7 months ago by Pixnub.
    • This reply was modified 1 year, 7 months ago by Pixnub.