Skip to main content
September 28, 2010
Question

Single History state

  • September 28, 2010
  • 1 reply
  • 740 views

I have a script that runs as the first thing in the action. I'd like to add some code to the script that makes the entire action a single history step instead of the 25+ steps I currently have. Is that simple to do?

Thanks guys!

This topic has been closed for replies.

1 reply

Muppet_Mark-QAl63s
Inspiring
September 28, 2010

With versions CS4 & CS5 you have the document method suspendHistory() which should allow a single history step with one undo. For versions before that you may be able the set the app.preferences.numberofHistoryStates to 1 but I have NOT tried this myself but Im almost sure you will get the undo functionality should you try this…

September 28, 2010

I'm on CS5 here at work. I should also point out that I know very little about coding. I tried to steal the "one history step" java code from another action that was in the default scripts for photoshop, I think it was the delete all empty layers script. It had code in there I thought I could borrow but It just errored when I dropped it in my script (in the beginning).

ian shook | lead artist | farm | cp |312.243.0044 x 104

Muppet_Mark-QAl63s
Inspiring
September 28, 2010

I have neither CS4 or CS5 to test with (which is a big problem for me). But I would guess the code goes something like…

app.activeDocument.suspendHistory('Foo');

// Do the rest of your stuff here…

If Im reading the docs correct then 'Foo' would be the name string in the history step? For that single step that you can undo… Of cause you can change that name if thats how this works?