6 Replies Latest reply on Jun 22, 2009 1:52 AM by [Jongware]

    Search auto page number...

    Oviya... Level 1

      Hi,

       

      I m using InDesign CS3.

      I need to search for auto-page number in an Indesign file through script...

      I m not able to do it...

      Can someone please guide me in doing this...

       

      Thank You.

      Mohan

        • 1. Re: Search auto page number...
          Kasyan Servetsky Level 5

          // Current Page Number

          var myFinds = app.findTextPreferences.findWhat = "^N";

          // Any Page Number

          var myFinds = app.findTextPreferences.findWhat = "^#";

          • 2. Re: Search auto page number...
            Oviya... Level 1

            Thanks for your reply...

             

            Anyhow I couldn't get the exact result what I want..

             

            Consider If I need to get the page number "2" using Find command , It takes the argument 2 as string. But autonumber page is in number format..Thus it returns "Cannot find match".

             

            How can I convert it into integer through script.

            • 3. Re: Search auto page number...
              Kasyan Servetsky Level 5

              //To convert from a string to an integer:
              myNumber = parseInt("2");

              • 4. Re: Search auto page number...
                Oviya... Level 1

                Thanks for your reply....

                 

                I need to find a number in a document. The number is 2 or 3 or something else. The number 2 is not present in the document as a running text or text. It is auto page number. like if i copy the number in the text box and paste in find dialog box means it'll like this "<0018>". This number is common for all auto page numbers. This number will be either 2 or 3. But how can i get the particular number  from this auto page number through script. Am using InDesign CS3.

                 

                Thanks in Advance.

                 

                Regards,

                Oviya

                • 5. Re: Search auto page number...
                  [Jongware] Most Valuable Participant

                  The "value" of an Auto Page Number is not fixed -- it displays (quite logically) the "value" for the current page number. So you cannot search for an "Auto Page Number with the value x".

                   

                  This shows a way to get a value for the placeholder:

                   

                  app.findTextPreferences.findWhat = "^N";
                  var myFinds = app.activeDocument.findText();

                  alert ("This is page "+myFinds[0].parentTextFrames[0].parent.name);

                   

                  Note that the parentTextFrames[0].parent construction only works for regular text frames on regular pages. If you want to search for any page number in any type of frame on any type of page (i.e., also on master pages), you will have to check the type of parent yourself.

                  • 6. Re: Search auto page number...
                    Oviya... Level 1

                    Thank you very much jongware...

                     

                    It's Working..