• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Top level group reference.

New Here ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

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!

Brad

TOPICS
Scripting

Views

165

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Contributor ,
Feb 07, 2017 Feb 07, 2017

Copy link to clipboard

Copied

LATEST

Hi,

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) {

  ret.select();

}

// page/spread/story

//   top-level-group ----> select this group

//     parent-parent-group

//       parent-group

//         target

 

thank you

mg.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines