1 Reply Latest reply on Feb 7, 2017 6:01 PM by milligramme

    Top level group reference.


      I've made a reference to a frame found via the scriptLabel. This frame and its corresponding group have successfully been (removed) every time, until I ran into an instance where the grouping structure changed (i.e. .parent.parent.parent.) is there a general reference to the top level of the group of a variable frame that has already been defined. I've tried myFrame.groupItems, groups, etc... with no luck.


      (myResult == true){myFrame.parent.parent.remove()}


      Thanks for any help!


        • 1. Re: Top level group reference.
          milligramme Level 3


          this snippet select a top-level-group what I understand.

          is my understanding correct?



          var sel = app.selection[0];
          var ret = find_parent(sel, 'Group');
          function find_parent (obj, constructor) {
            if (obj.parent.parent.constructor.name !== constructor) {
              return obj.parent
            else {
              return arguments.callee(obj.parent, constructor);
            return null
          if (ret) {
          // page/spread/story
          //   top-level-group ----> select this group
          //     parent-parent-group
          //       parent-group
          //         target



          thank you