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

Revert document?

New Here ,
May 16, 2014 May 16, 2014

Copy link to clipboard

Copied

Anyone know how to revert (or re-open) a document at the end of a script?

Cheers

TOPICS
Scripting

Views

415

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

Engaged , May 16, 2014 May 16, 2014

Just close it without saving, then reopen.

Here's the script in VB.NET, but you'll get the idea.

Dim aDoc As AI.Document = app.ActiveDocument

Dim fullName As String = aDoc.FullName

aDoc.Close(AiSaveOptions.aiDoNotSaveChanges)

app.Open(fullName)


Hope this helps.


-TT

Votes

Translate

Translate
Adobe
Engaged ,
May 16, 2014 May 16, 2014

Copy link to clipboard

Copied

Just close it without saving, then reopen.

Here's the script in VB.NET, but you'll get the idea.

Dim aDoc As AI.Document = app.ActiveDocument

Dim fullName As String = aDoc.FullName

aDoc.Close(AiSaveOptions.aiDoNotSaveChanges)

app.Open(fullName)


Hope this helps.


-TT

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
New Here ,
May 16, 2014 May 16, 2014

Copy link to clipboard

Copied

Thanks, I've found myself at a similar solution. I'm working in Javascript...

This works:

function revertDoc() {

  var docsource = activeDocument.fullName;

  app.activeDocument.close(SaveOptions.DONOTSAVECHANGES);

  app.open(docsource);

}

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
Engaged ,
May 16, 2014 May 16, 2014

Copy link to clipboard

Copied

LATEST

Actually, mine works just fine in Javascript too.

TestScript();

function TestScript() {

    var aDoc = app.activeDocument;

    var fullName = aDoc.fullName;

    app.activeDocument.close (SaveOptions.DONOTSAVECHANGES);

    app.open (fullName)

}

Have you tried closing AI and reopening it and running the script fresh? AI notes that there are suggested limits for the number of times that you can open/close documents (can't put my finger on it now) -- might be worth a try.

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