Photoshop's History Panel has options:

enter image description here

Which has the following options:

enter image description here

Is there a way to read / write those preferences using Photoshop Scripting / ExtendScript?

4 Answers 4


Usually options like that are accessible via a deeper layer of Photoshop preferences: Action Descriptors. But I think the ones you mentioned aren't available even in it: I had the same problem trying to find a way to change Show Current Tool Only in Tool Presets window. I tried to use xbytor's Getter script but it didn't register any changes when I was setting this option on and off. So I don't think this option is available for scripting unfortunately.


The following seems to work on Photoshop CC 2019:

    var d = new ActionDescriptor();     
    var r = new ActionReference();     
    r.putProperty(stringIDToTypeID("property"), stringIDToTypeID("layerVisibilityChangesAreUndoable"));  
    r.putEnumerated(stringIDToTypeID("application"), stringIDToTypeID("ordinal"), stringIDToTypeID("targetEnum"));     
    d.putReference(stringIDToTypeID("null"), r);     

    var d1 = new ActionDescriptor();     
    d1.putBoolean(stringIDToTypeID("layerVisibilityChangesAreUndoable"), false);     

    d.putObject(stringIDToTypeID("to"), stringIDToTypeID("layerVisibilityChangesAreUndoable"), d1);  

    executeAction(stringIDToTypeID("set"), d, DialogModes.NO);  
  • Interesting, the option is available in both CC2018 and CC2019 but it has a key only in CC2019: so this code works in CC2019 but not in CC2018. And this explains why I didn't find the key in my CC2018 while running a getter script. Apr 7, 2019 at 12:30

Yes It Is Possible But Not As You Want

Basically Photoshop Script DOM Have History State Option; But It Only Allows to jump back to History State and Revert It; So It Means You can control Which Step You Want to revert in script: See Below

enter image description here

So Basically In Order to Revert To Any Step You Can Do Something Like This

var docRef = app.activeDocument; docRef.ActiveHistoryState = docRef.HistoryStates[1];

This Will Revert Your Work And Will Get Back To your 1st History State; Or In Advance If You want To go to specific Step Use Prompt Like Below;

var docRef = app.activeDocument; var step = prompt("Which step You wanna Go";""); docRef.ActiveHistoryState = docRef.HistoryStates[step];

But If You Want To access That Specific History Option I'm feared that It Is Possible to access via script;Refer Below Link For More Details; You Can Find More About It On Page Page No .48

enter image description here

I Know This Might Not What You want but hope It Helps You to understand Photoshops DOM; -Regards Phoenix Design

  • 1
    Hi, Thank you for the effort. I am not after the History State of Photoshop. I am specifically after altering the the option Make Layer Visibility Changes Undoable. I think I saw once you can alter preferences of Photoshop using ExtendScript, hence I wonder if there is an option to access those.
    – Royi
    Apr 4, 2019 at 3:58
  • Yeah I Thought So Since You specified it in 2nd picture; But as you can see it in Official Reference They Have No Such A option ;Will See If there is another options :)
    – Mr.Online
    Apr 4, 2019 at 4:37
  • See my answer above.
    – Royi
    Apr 7, 2019 at 8:27
  • yeah mostly i didn't use actionDescriptor since i'm not well aware of it :) thanks for your script
    – Mr.Online
    Apr 8, 2019 at 3:37

You can set non-linear history to true like this:

var idsetd = charIDToTypeID( "setd" );
var desc17 = new ActionDescriptor();
var idnull = charIDToTypeID( "null" );
    var ref2 = new ActionReference();
    var idPrpr = charIDToTypeID( "Prpr" );
    var idCchP = stringIDToTypeID( "historyPreferences" );
    ref2.putProperty( idPrpr, idCchP );
    var idcapp = charIDToTypeID( "capp" );
    var idOrdn = charIDToTypeID( "Ordn" );
    var idTrgt = charIDToTypeID( "Trgt" );
    ref2.putEnumerated( idcapp, idOrdn, idTrgt );
desc17.putReference( idnull, ref2 );
var idT = charIDToTypeID( "T   " );
    var desc18 = new ActionDescriptor();
var idCchP = stringIDToTypeID( "historyPreferences" );
desc17.putObject( idT, idCchP, desc18 );
executeAction( idsetd, desc17, DialogModes.NO );

Older answer: In Photoshop preferences file it is the byte next to "HstN" key with type of boolean. Strings are reversed due to its endianness. Far from perfect but it is readable. If someone changes this after PS start then you won't know it.

1 = enabled.

Settings is loaded/applied with PS startup and saved with PS quit.

enter image description here

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.