1 Reply Latest reply on Sep 21, 2010 10:39 AM by Kasyan Servetsky

    Cement Automatic Page Numbers in Place

    GD_lewis

      Hi everyone,

       

      I have done a search on this but I'm struggling to find the right answers.

       

      I have a document with an automatic page number on each page. What I want to be able to do is lose the 'automatic-ness' so that when I shuffle the pages around, the number remembers where it used to be. ie. on each page I'll have text that reads "Spread carried over from page 22 of previous revision of document".

       

      Is there a script that I can use to achieve this?

       

      Please let me know if you need further clarification!

       

      Much appreciated,

      Lewis

        • 1. Re: Cement Automatic Page Numbers in Place
          Kasyan Servetsky Level 5

          A few days ago I wrote such a script -- run it against this sample document to see how it works.

           

          Kasyan

           

          var doc = app.activeDocument;
          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;
          app.findTextPreferences.findWhat = "^#";
          var finds = doc.findText();
          var found;

          for (var i = 0; i < finds.length; i++) {
               found = finds[i];
               try {
                    var pageName = found.parentTextFrames[0].parent.name;
                    found.contents = pageName;
               }
               catch(err) {}
          }

          app.findTextPreferences = app.changeTextPreferences = NothingEnum.nothing;

          alert("Done");