UXP Photoshop History State change

Hello im updating my old legacy script to new UXP Photoshop panel script.
i need to know how to set the active history state back to when you first opened the psd file… here is a code snippet that use to work

    activeDocument = app.documents[p];
    var savedState = activeDocument.activeHistoryState

    activeDocument.activeHistoryState = activeDocument.historyStates[0];

Hello, you might want to try this:

   "_obj": "revert"
}], {});
1 Like

thank you that worked well!

Here’s another option:

const result = await batchPlay(
“_obj”: “select”,
“_target”: [
“_ref”: “historyState”,
“_enum”: “ordinal”,
“_value”: “first”
“_isCommand”: true,
“_options”: {
“dialogOptions”: “dontDisplay”
“synchronousExecution”: false,
“modalBehavior”: “fail”