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

How to navigate the "selected" array

Community Beginner ,
Jun 03, 2011 Jun 03, 2011

The activeDocument.selected property provides access to an array of objects (the selected objects). The array elements are of types "PathItem," "TextFrame," "GroupItem," etc.

If I view this in the Data Browser, and expand one of the "GroupItem" elements, I do not see the other paths, text, subgroup objects that compose this group. Although the documentation says that "groupItems" is a property of the GroupItem class, I do not see this property in the Data Browser, so there is nothing to expand to see the object hierarchy. Furthermore, without access to a groupItems property, there doesn't appear to be a way to use a getByName method to get any of the objects that way.

Why doesn't the "groupItems" property of a GroupItem object show up in the Data Browser?

How does one access the various objects (text, paths) that comprise a GroupItem?

Thanks!

Ben

TOPICS
Scripting
651
Translate
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

correct answers 1 Correct answer

Guide , Jun 03, 2011 Jun 03, 2011

Ben, the data browser does not work in that depth… Script Debugger for AppleScript has an object navigator/viewer that does this and its great you can dig right down into your docs and see all the properties and their values… If you want more info then you are best having your script write what it is your looking for back the the ESTK console… To do this use…

$.write(someData); $.writeln(someData);

So you can for instance…

var doc = app.activeDocument; // I know I have this var lay = doc.layers.g

...
Translate
Adobe
Community Expert ,
Jun 03, 2011 Jun 03, 2011
"groupItems" is a property of the GroupItem class"

it gives you access to groups inside groups, if you have group A and group B, both grouped together into group C, then

groupItems["group C"].groupItems[0]; // returns group A

groupItems["group C"].groupItems[1]; // returns group B

groupItems["group B"].pageItems[0]; // returns whatever first item is inside group B

//same as

groupItems["group C"].groupItems[1].pageItems[0]; // returns whatever first item is inside group B

Translate
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
Guide ,
Jun 03, 2011 Jun 03, 2011
LATEST

Ben, the data browser does not work in that depth… Script Debugger for AppleScript has an object navigator/viewer that does this and its great you can dig right down into your docs and see all the properties and their values… If you want more info then you are best having your script write what it is your looking for back the the ESTK console… To do this use…

$.write(someData); $.writeln(someData);

So you can for instance…

var doc = app.activeDocument; // I know I have this var lay = doc.layers.getByName('Layer 1'); // Ditto this too var grp = lay.groupItems.getByName('Blah'); // Ditto this too

var grpItems = grp.pageItems; for ( var i = 0; i < grpItems.length; i++ )      {           $.writeln(grpItems.typename);      }

Translate
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