Skip to main content
Participating Frequently
April 20, 2017
Answered

How to use a single undo to undo a script which contains multiple sub-actions.

  • April 20, 2017
  • 1 reply
  • 3477 views

Hi,

I had expected there to be lots of people asking this so that suggests that it's either very easy and I am being dumb or it's very hard and that's why no one is trying it.

I would like to run a Javascript function in Photoshop which contains multiple sub-actions. The script runs fine but when I undo I have to undo once for each sub-action to get back to me original state.

How do I run a script so that the entire script counts as a single undo?

Thanks

This topic has been closed for replies.
Correct answer SuperMerlin

Either create a snapshop and revert back to it or use suspendHistory()

if(documents.length) app.activeDocument.suspendHistory('History Name', 'functionName()');

1 reply

SuperMerlin
SuperMerlinCorrect answer
Inspiring
April 20, 2017

Either create a snapshop and revert back to it or use suspendHistory()

if(documents.length) app.activeDocument.suspendHistory('History Name', 'functionName()');

Participating Frequently
April 21, 2017

Perfect, thanks!