Copy link to clipboard
Copied
Hi!
I don´t know if it is that obviously but I didn't found an explanation why this line causes an error:
alert(app.documents[0].groups[0].count());
The group contains a rectangle and a textFrame. (I want to separate those groups from others with more objects or other KIND of objects.)
Here I´ve read something like:
...
number count ()
Displays the number of elements in the Group.
...
Did I misunderstood the hint?
regards
A.
alert(app.documents[0].groups[0].allPageItems.length)
Copy link to clipboard
Copied
Hi; try this
alert(app.documents[0].groups[0].rectangles.count());
Copy link to clipboard
Copied
Hi & thanks!
herewith I just get the number of rectangles. But I need the number of all the objects inside.
Copy link to clipboard
Copied
alert(app.documents[0].groups[0].allPageItems.length)
Copy link to clipboard
Copied
Thank you peter for the (again) perfect shot from the hip.
Sometimes I mess with such trifles for two days ...
Copy link to clipboard
Copied
Yes;
Notice the difference between the two
alert(app.documents[0].groups[0].allPageItems.length);
alert(app.documents[0].groups[0].pageItems.length);
Copy link to clipboard
Copied
I suppose the fourth item is the group itself (?)
Copy link to clipboard
Copied
No! image and container(Frame)
Copy link to clipboard
Copied
I try to understand...
initial situation: you have a group of a rectangel, a textFrame and a picture. Is that right?
And with "allPageImages" you can recall even "nested" objects.
That´s a good hint. thanks
Copy link to clipboard
Copied
And with "allPageImages" you can recall even "nested" objects.
FWIW: One exception:
Not active states of a MultiStateObject (MSO) are left out.
Regards,
Uwe
Copy link to clipboard
Copied
Hm. Seems that you removed the last reply.
FWIW: I just wanted to answer:
You first have to resolve the pageItem with getElements() ( returns an Array ).
( If you ask for pageItem you'll get pageItem ( in most cases ) 😉 )
var resolvedItem = app.documents[0].groups[0].pageItems[0].getElements()[0];
if(resolvedItem.constructor.name == "Rectangle")
{// do something};
Regards,
Uwe
Copy link to clipboard
Copied
Yes. sorry.
I found the solution and didn´t want to bother the community with boring questions...
But thanx you for your answer with helpful facts.
Regards
A.
Find more inspiration, events, and resources on the new Adobe Community
Explore Now