5 Replies Latest reply on Dec 12, 2012 2:11 AM by Mahesh_JW

    How to move a pageItem is in overset

    Mahesh_JW Level 1

      Hi All,

           The below code is execute proberly when it is not in overset. But if it is in overset it throws error.

       

      MyXMLElement.select();

      app.menuActions.itemByID(78629).invoke();                    //Go to Item

      var grp = app.selection[0].parentTextFrames[0];

      grp.select();

       

      if(grp.parent.constructor.name != "Character"){     //to avoid anchor item

           while(grp.parent.constructor.name != "Page"){

                grp = grp.parent;

           }

       

           grp.move(app.activeDocument.pages[-1]);     //move last page

      }

       

       

      "grp.select()" throws error. How can I move the group item to last page.

       

       

      Thanks in Advance,

      Mahesh

        • 1. Re: How to move a pageItem is in overset
          Jump_Over Level 5

          Hi,

           

          1. var grp = app.selection[0].parentTextFrames[0];

          if textFrame is overset ==> there is no (undefined) parentTextFrame property value.

          ... but why are you trying to select a textFrame?

          Are you going to move a frame?

           

          2. while(grp.parent.constructor.name != "Page"){

               grp = grp.parent;

          here your grp is a Page, so you want to move a page?

           

          3. grp.move(app.activeDocument.pages[-1])

          this is wrong parameter, I guess. You can't move a page to page;

           

          rgds

          • 2. Re: How to move a pageItem is in overset
            Mahesh_JW Level 1

            Hi,

            Thanks for your response.

             

            1. My task is traverse in xml Element, if it is in floating element list [Figure, Table, Marginalnote, Sidebar] then select that "Group" and move to consecutive last page. But not to move any anchor items.

             

            2.

            while(grp.parent.constructor.name != "Page"){

                 grp = grp.parent;

            }

             

            after executing this loop "grp" contains only Group not Page, so I can move that Group to last page

             

            3. The Problem is Groups are overlapping ( the Group lie on the top of other Group) so I am trying to select that Group throws error

             

            Regards

            Mahesh

            • 3. Re: How to move a pageItem is in overset
              Jump_Over Level 5

              Hi,

              I afraid I am lost...

               

              If grp is alike text ==> repeating grp.parent goes through Story-Document-Application (open loop?)

              If grp is alike pageItem ==> repeating grp.parent goes through Spread-Document-Application (open loop?)

              ... or am I missing something?

               

              But in general I am still not sure what kind of item are you going to move.

               

              rgds

              • 4. Re: How to move a pageItem is in overset
                Mahesh_JW Level 1

                Hi,

                Sorry for the confusion. My task is select Group item [Combination of figure and caption, table and caption,mutiple textframe] and move to consecutive last page. In my document many of the groups are overlapped [the Group lie on the top of other Group] so I can't select the group to move.

                 

                NOTE:

                1. All the groups are applied "Wrap"

                2. I am not using pageItem for-loop iteration to select Group. I am traverse in XML Structure Pane and select XML content [goto item], and select parent grouped item and move to last page.

                 

                Regards

                Mahesh

                 


                • 5. Re: How to move a pageItem is in overset
                  Mahesh_JW Level 1

                  MyXMLElement.select();

                  var grp = MyXMLElement.xmlContent.textContainers[0];

                  while(grp.parent.constructor.name != "Page" && grp.parent.constructor.name != "Document"){

                       grp = grp.parent;

                  }

                   

                  var myGroup = grp;

                   

                   

                   

                  here is the answer....