Skip to main content
Inspiring
May 30, 2019
Answered

How to define undo.isValid?

  • May 30, 2019
  • 1 reply
  • 588 views

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

This topic has been closed for replies.
Correct answer Manan Joshi

Hi John,

Try the following

if(app.activeDocument.undoHistory.length)

    app.activeDocument.undo();

-Manan

1 reply

Manan JoshiCorrect answer
Brainiac
May 30, 2019

Hi John,

Try the following

if(app.activeDocument.undoHistory.length)

    app.activeDocument.undo();

-Manan

JohnwhiteAuthor
Inspiring
May 30, 2019

thank you Man,

thank so much.

John