I facing some trouble with app.undo(). I call a large script with doScript with UndoMode.Entire_Script and an undo name. The script performs a bunch of actions, one of which adds an item in the undo history named "Set Measure Units". After the doScript call completes, I want to undo all the actions performed by the script. So I call undo in a loop till I reach the doScript action. It looks something like
} while (app.undoName != "MyScriptName");
However, the app.updo() call fails with a message "Unable to undo last action". This happens even if I remove the loop and call app.undo just once. Any clue why this might be happening? Thank you in advance.
give it like this