Highlighted

Revert to original file

Community Beginner ,
Jan 22, 2020

Copy link to clipboard

Copied

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?

TOPICS
How to, Scripting

Views

379

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Revert to original file

Community Beginner ,
Jan 22, 2020

Copy link to clipboard

Copied

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?

TOPICS
How to, Scripting

Views

380

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Jan 22, 2020 0
Adobe Community Professional ,
Jan 22, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 22, 2020 0
Community Beginner ,
Jan 23, 2020

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 23, 2020 0
Adobe Community Professional ,
Jan 22, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 22, 2020 0
Adobe Community Professional ,
Jan 23, 2020

Copy link to clipboard

Copied

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

 

Not sure how to bypass the dialog though.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 23, 2020 0
Explorer ,
Jun 09, 2020

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 09, 2020 0
Adobe Community Professional ,
Jun 10, 2020

Copy link to clipboard

Copied

@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.

 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 10, 2020 0
Adobe Community Professional ,
Jun 10, 2020

Copy link to clipboard

Copied

what about:

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. 

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 10, 2020 1