3 Replies Latest reply on Nov 14, 2010 7:44 PM by Thamizh20

    Get Page Number CS5

    boblako

      a=app.selection[0].parent

      alert(a)

       

      In CS5 when I select the group, the alert is shown: "Object Spread". So, I can't get page number of the selected group. In CS 4 it works ok (the same app.selection[0].parent shows "Object Page") so I can write "app.selection[0].parent.name" and get the page number.

        • 1. Re: Get Page Number CS5
          Olav Martin Kvern Level 3

          Hi boblako,

           

          Use parentPage instead of parent, and you should be fine.

           

          Thanks,

           

          Ole

          • 2. Re: Get Page Number CS5
            Peter Kahrel Adobe Community Professional & MVP

            There you are! Got stuck in traffic, didn't you?

             

            Peter

            • 3. Re: Get Page Number CS5
              Thamizh20

              How to get the XmlElement insertionPoints page number in CS5.

               

              The below code is working in CS3 and CS4, but not CS5, Pl give me the solution ASAP

               

               

              function myStep1()
                {
                   this.name = "myStep1";
                   this.xpath = "//target ";
                   this.apply = function(myElement, myRuleProcessor)
                     {
                        with(myElement)
                          {

               

               

                             var myVal = myElement.xmlAttributes.item("id").value;

               

                                try

               

                               {

               

                                 temp=myElement.insertionPoints[0].parentTextFrames[0].parent.name;'(Getting page number)

               

                                   alert(temp);

               

                                   if(temp!="")

               

                                   {

               

               

               

                                      ffile.write("<targetid>"+myVal+"</targetid>");

               

                                      ffile.write("\t");

               

                                      ffile.write("<pageno>"+temp+"</pageno>", "\n");

               

                                  }

               

                               }

               

                              catch(e)

               

                              {

               

                                   temp=myElement.insertionPoints[0].parentTextFrames[0].parent.parent.name;'(Getting page number)

               

                                   if(temp!="")

               

                                   {

               

                                      ffile.write("<targetid>"+myVal+"</targetid>");

               

                                      ffile.write("\t");

               

                                      ffile.write("<pageno>"+temp+"</pageno>", "\n");

               

                                  }

               

                              }

               

                          }

               

                        return false;

               

                   }

               

              }