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

How to define undo.isValid?

Contributor ,
May 30, 2019 May 30, 2019

Hi experts,

if my script like this

app.activeDocument.undo();

for undo activeDocument last changed

but if it is nothing to undo it will give me an error;

how can make the script something like

if (app.activeDocument.undo.isValid)

{app.activeDocument.undo();}

???

thanks

regard

John

TOPICS
Scripting
455
Translate
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

Community Expert , May 30, 2019 May 30, 2019

Hi John,

Try the following

if(app.activeDocument.undoHistory.length)

    app.activeDocument.undo();

-Manan

Translate
Community Expert ,
May 30, 2019 May 30, 2019

Hi John,

Try the following

if(app.activeDocument.undoHistory.length)

    app.activeDocument.undo();

-Manan

Translate
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
Contributor ,
May 30, 2019 May 30, 2019
LATEST

thank you Man,

thank so much.

John

Translate
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