Not sure I follow. Illustrator already has a Revert option within the File menu.
app.undo() works as if you use undo manually, you might have to use it multiple times. Unfortunately I'm not sure if you can go back to a specific point in the undo history.
Not sure how to bypass the dialog though.
I have the same question, and did run into the problem of dialog.
The statement that I used is: app.doScript ("Revert", "Default Actions");
which is a default action that comes with the system.
Look like I'll just have to close (without saving) and re-open.
Actually, if there were some way of finding out how many undos there are, I could just use undo, which may be a little faster than closing and opening. But, then, I am not confident that Illustrator's undo/redo history is truly complete and reliable.
By the way, I am running Illustrator 2020 v.20.1.3(64bit) (CS6) , and there is no executeMenuCommand command.
I'm confused about your message here.. You seem to be saying some contradictory things.
Are you using Illustrator 2020? Or are you running Illustrator CS6? Or are you using Illustrator 20.1.3?
If you're using Illustrator 2020 or CS6, then you do have access to executeMenuCommand();
If you are using v20.1.3, and you're using the "revert" default action, look to the left hand side of the actions panel. The checkmark on the far left means that that step of the action is "active". If you uncheck that box, that step will be skipped. On some steps of the action, you'll see a square just to the right of the checkbox. this box indicates whether or not to show the dialog associated with that step. In most cases, you should be able to click that square to disable the dialog while the action is running.
Hope this helps.
app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;
There are some things this fixes, and others that it doesn't. Worth a shot.
Note: let's say this setting causes you to miss certain other important dialogs for some reason.. No worries. you don't need to use this setting for your whole script. you could set the interaction level before using "revert" and then reset the interaction level right after that.