• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Force revert in InDesign CS4 js

Participant ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

Hi,

I need to revert my indd document to the last saved state in the end of the script and suppress the dialog box for it. When I run this line:

myDoc.revert();

I get the dialog box.

So I tryed:

myDoc.revertToProject();

and it gives me an error. What do I need to do to make it work.

Thank you for your help.

Yulia

TOPICS
Scripting

Views

2.0K

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
community guidelines

correct answers 1 Correct answer

Deleted User
Nov 05, 2010 Nov 05, 2010

Yuliaart wrote:

If I could just close the document without saving any changes and without showing the dialog would be even better. But I don't see closing with the option of not saving. How can I do that.

Thank you,

Yulia.

myDoc.close(SaveOptions.no)

Votes

Translate

Translate
Community Expert ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

Close without saving, then re-open?

(Alternatively, although it would seem to me it does the exact same thing, you could try suppressing the dialogs before calling revert().)

Votes

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
community guidelines
Participant ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

If I could just close the document without saving any changes and without showing the dialog would be even better. But I don't see closing with the option of not saving. How can I do that.

Thank you,

Yulia.

Votes

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
community guidelines
Guest
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

Yuliaart wrote:

If I could just close the document without saving any changes and without showing the dialog would be even better. But I don't see closing with the option of not saving. How can I do that.

Thank you,

Yulia.

myDoc.close(SaveOptions.no)

Votes

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
community guidelines
Participant ,
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

Beautiful.

Thank you.

Yulia

Votes

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
community guidelines
Guest
Nov 05, 2010 Nov 05, 2010

Copy link to clipboard

Copied

This might work. I have not tested it. I use try/catch to make sure that the last line runs and turns on user interaction.

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.neverInteract;

try{

     myDoc.revert();

} catch(error) {}

app.scriptPreferences.userInteractionLevel = UserInteractionLevels.interactWithAll;

Votes

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
community guidelines
Community Beginner ,
May 25, 2021 May 25, 2021

Copy link to clipboard

Copied

LATEST

Tried this in one of my own scripts - Worked perfectly.  Thanks

Votes

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
community guidelines
Guest
Oct 26, 2011 Oct 26, 2011

Copy link to clipboard

Copied

Urgent help needed. I accidentally pressed "save" in my Indesign CS4 file after deleting most of the pages. I can't undo right away and the revert is always in grey after I restarted Indesign or the whole computer. Is there a way that I can revert to my last saved state of the file? Where do you put all the scripts you both mentioned above?

I have an urgent deadline for this job. It will take me a long time to recreate all the changes again. Please help asap!

Votes

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
community guidelines
LEGEND ,
Oct 26, 2011 Oct 26, 2011

Copy link to clipboard

Copied

It sounds like you are talking about a different situation. Once you close a doc after saving, there's nothing to revert to...

Sorry.

Harbs

Votes

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
community guidelines