3 Replies Latest reply on May 16, 2014 7:16 AM by ThinkingThings

    Revert document?

    mrblix Level 1

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



        • 1. Re: Revert document?
          ThinkingThings Level 2

          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



          Hope this helps.


          • 2. Re: Revert document?
            mrblix Level 1

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


            This works:


            function revertDoc() {

              var docsource = activeDocument.fullName;




            • 3. Re: Revert document?
              ThinkingThings Level 2

              Actually, mine works just fine in Javascript too.




              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.