What's new
Photoshop Gurus Forum

Welcome to Photoshop Gurus forum. Register a free account today to become a member! It's completely free. Once signed in, you'll enjoy an ad-free experience and be able to participate on this site by adding your own topics and posts, as well as connect with other members through your own private inbox!

How to delete all history STATES (not history) - or other solution to a master macro


Status
Not open for further replies.

Andreas Fransholm

New Member
Messages
2
Likes
0
Skärmavbild 2015-09-25 kl. 25 00.08.18.png

I am trying to set up a workflow for my coworkers to easy adjust color, brightness and so on simply by clicking on a SNAPSHOT that easily shows them the result. The SNAPSHOT is generated by a master macro that calls alarge number of macros. But my clever :) solution fails because I would like to give them the oppurtunity to run the master macro twice (for example to adjust brightness) and they are then prompted with a dialog that asks them if they would like to overwrite the SNAPSHOT that already exist wit the the same name. I simply cant find an easy way to delete SNAPSHOTS. History palette is easy to delete. If this was just a handful of macros I could figure out a way to fix it manually, but I have like 80-100 macros in different groups.



I have thought of this solution:


MASTER MACRO 1
- SELECT ALL. COPY.
- DELETE ALL SNAPSHOTS (with script)
- PASTE IMAGE
- RUNS MACRO APPLE (saving snapshot Apple)

- RUNS MACRO TOMATO (saving snapshot Tomato)

- GOES ON FOR SEVERAL MORE ...



The user chooses snapshot TOMATO and also wants to run snapshot APPLE. Clicks MACRO 1 again.





Anyone out there that can think of a solution or other idea?





(Photoshop CS6 on a Mac)
 
Last edited:

Paul MR

The Script Master
Messages
382
Likes
206
Re: How to delete all history STATES (not history) - or other solution to a master ma

This is one way to delete all Snapshots.
Code:
var doc = app.activeDocument;
var hs = doc.historyStates;
for(var a =hs.length-1;a>=0;--a){
   if(hs[a].snapshot) {
       doc.activeHistoryState = hs[a];
       delHist();
       }
}
function delHist() {
var desc20 = new ActionDescriptor();
var ref23 = new ActionReference();
ref23.putProperty( charIDToTypeID('HstS'), charIDToTypeID('CrnH') );
desc20.putReference( charIDToTypeID('null'), ref23 );
executeAction( charIDToTypeID('Dlt '), desc20, DialogModes.NO );
};
 

Andreas Fransholm

New Member
Messages
2
Likes
0
Re: How to delete all history STATES (not history) - or other solution to a master ma

Works like charm. Thanks! Thanks! Thanks! :thumbsup:
 
Status
Not open for further replies.

Top