5 Replies Latest reply on Sep 23, 2016 11:28 AM by cbishop01

    AutoSave question?

    cbishop01 Level 2

      Is there a code out there that can Save a document (.indd) every 5 or 10 min's to a specific Folder?

       

      Thank you.

      CHris bishop

        • 1. Re: AutoSave question?
          Loic.Aigon Adobe Community Professional

          Yes and no. But first remember that "autosave" is part of the native features of the application in case of crashes. Besides, saving every 10 minutes wouldn't be a ife saver to me (so many edits can be done in such a time). But if you need something fancier you can think of idleevents even if in this case, you couldn't set like 10mns gap because that would mean you dont' do anything of InDesign at that time. However, you could still use idle evets with a shorter loop and run your routine only if the minutes are 5 multiples (i.e. 5, 10, 15…).

           

          FWIW

           

          Loic

          1 person found this helpful
          • 2. Re: AutoSave question?
            cbishop01 Level 2

            My only trouble with AutoSave in indesign is that sometimes it crashes and the file does not come back up with the edits i have made in the past few min's.  Is there a way to alter the Recovery options in indesign?  to make it kinda save every few min's?  I do think that having a autosave would get cluttered quick. Having new files Saving every 2 is min's.   Or is there a way to make indesign save the file's every 2 or 3 min's (is this what your talking about above?) Not placing in a different folder just saving overtop of itself.  Or Do you foresee problems with that as well?

            • 3. Re: AutoSave question?
              Loic.Aigon Adobe Community Professional

              You can try this…

               

              #targetengine "saveEvery1mn"
              main();
              
              
              var filter = function() {
                var w = "InDesign files:*.indd;",
                m = function(f) {return /\.indd$/.test(f.name); };
              
              
                return $.os[0]=="W"?w:m;
              }
              
              
              function main() {
              
                var t = (new Date()).getTime();
              
                var onIdleEventHandler = function(idleEvent) {
              
                var doc = app.properties.activeDocument;
              
                if ( !doc ) return;
              
                if ( !doc.properties.fullName ) {
              
                var f = File.saveDialog("You need to save your document now !", filter);
                if ( f ) {
                doc.save ( f );
                }
                return;
                }
              
                var t2 = (new Date()).getTime();
              
                if ( t2-t > 1000 )  {
                t = t2;
                doc.save();
                }
                }
              
              
                var myIdleTask = app.idleTasks.item("autoSave");
              
                if ( !myIdleTask.isValid ) {
                myIdleTask = app.idleTasks.add({name:"autoSave", sleep:100});
                myIdleTask.addEventListener(IdleEvent.ON_IDLE, onIdleEventHandler, false);
                }
              }
              
              
              
              

               

               

              HTH

               

              Loic

              Ozalto | Productivity Oriented - Loïc Aigon

              1 person found this helpful
              • 4. Re: AutoSave question?
                cbishop01 Level 2

                Thank you this actually does mostly what i wanted.  It will definitely help when Indesign Crashes. 

                • 5. Re: AutoSave question?
                  cbishop01 Level 2

                  Is there a way to delay this until a change has been made?  So that way if we just open a file on accident it don't save it.  I am looking for an eventlistener for afterEdit but i'm not seeing one.