Skip to main content
Katrina2023
Participant
January 23, 2020
Question

Revert to original file

  • January 23, 2020
  • 3 replies
  • 1909 views

Hey, I am looking for a way to revert my file to its original state after I run my script. I have been unable to find a way to do this. Is there a function that does this with Javascript? Or is it possible to have illustrator simply close the active document, then reopen it?

This topic has been closed for replies.

3 replies

rcraighead
Legend
January 23, 2020

This works:
app.executeMenuCommand("revert");

 

Not sure how to bypass the dialog though.

carlyuanliu
Known Participant
June 9, 2020

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.

Disposition_Dev
Legend
June 10, 2020

@carlyuanliu

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.

 

CarlosCanto
Community Expert
Community Expert
January 23, 2020

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.

Michael Bullo
Community Expert
Community Expert
January 23, 2020

Not sure I follow. Illustrator already has a Revert option within the File menu.

Katrina2023
Participant
January 23, 2020

Sorry, I want to be able to use the revert option using javascript, so I can include it in a script that I have built