• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

Community Beginner ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

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

TOPICS
Actions and scripting

Views

3.1K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Guide , Apr 20, 2017 Apr 20, 2017

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

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

Votes

Translate

Translate
Adobe
Guide ,
Apr 20, 2017 Apr 20, 2017

Copy link to clipboard

Copied

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

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

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Apr 21, 2017 Apr 21, 2017

Copy link to clipboard

Copied

Perfect, thanks!

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Engaged ,
Jul 26, 2018 Jul 26, 2018

Copy link to clipboard

Copied

LATEST

can you use the same for InDesign? If so, where do you add into the script?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines