So, its been a month, I am very sorry for the late reply. As a quick explanation: First I needed some time to go through your code, I didnt want to just say “I dont understand”. Then I had an epileptical seizure, was in a hospital for a few days and needed a bit to “reboot” my brain afterwards. Unfortunately I have a partial blackout of the weeks before that, the time where I started dabbling in UXP, so I had to relearn all I knew about that.
Thanks again for your effort. In the end I couldnt get your code to run at all, I fear its not Manifest 5, API 2, compliant? It’s throwing errors all over the place. I had fixed a few other things before, but ultimately failed because of the error “ReferenceError: CSEvent is not defined”. I couldnt find anything about that on the net.
In the end this thread, which I already linked above, rescued me: UXP Photoshop History State change
I think what I did wrong is that I didnt wrap it in executeAsModal back before I first asked? I think the executeAsModal is a pretty new addition and wasnt needed back when the original thread was opened? But don’t take my bet on this one.
Here is the working code for me:
core.executeAsModal(() => {
require("photoshop").action.batchPlay([{
"_obj": "revert"
}], {});
});
I really do not like the solution, as I do not like batchPlay (it’s terrible to read and I cant believe that Adobe hasnt properly implemented history states into UXP yet. Like, really, this is such a fundamental feature!) and also it doesnt actually solve the problem, but circumvents it (it reverts back to the beginning of the history, which works fine in my case, but next time I might want to set a history state freely on my own).
Yet again, thank you very much for your support! I find the UXP documentation to be hell, so your comment is very much appreciated!