Copy link to clipboard
Copied
Hello,
I'm looking for a script to be able to create a group of all items on page and to do it for all page in the document. I found a script here https://community.adobe.com/t5/indesign-discussions/group-all-items-on-page-in-a-document/td-p/87109... but on line :
if (spreads.pageItems.length > 1) {
I get an "undefined is not an object"
Configuration :
Windows 11
Indesign 2022 / 17.2.1 X64
Thanks
Hi @NexusFred , Some older form posts can get corrupter. The [i] variable in Peter’s script is missing should be:
spreads = app.documents[0].spreads.everyItem().getElements();
for (i = 0; i < spreads.length; i++) {
if (spreads[i].pageItems.length > 1) {
spreads[i].pageItems.everyItem().locked = false;
spreads[i].groups.add (spreads[i].pageItems);
}
}
So to make it easier to do, I'm trying to group the content of each page so that I only have to move one block on each page.
Just note that the script will take all the page items and move them onto a single Layer—grouped objects can not have pageitems on different layers
Copy link to clipboard
Copied
By pages - you mean 1,2,3,4 etc. in single pages
or do you need page 1 grouped
then page 2-3 in a spread?
And so on?
Copy link to clipboard
Copied
Or if it's spreads - just page 2 items, then page 3 items - or group all of them together.
Copy link to clipboard
Copied
Hi @NexusFred , Some older form posts can get corrupter. The [i] variable in Peter’s script is missing should be:
spreads = app.documents[0].spreads.everyItem().getElements();
for (i = 0; i < spreads.length; i++) {
if (spreads[i].pageItems.length > 1) {
spreads[i].pageItems.everyItem().locked = false;
spreads[i].groups.add (spreads[i].pageItems);
}
}
Copy link to clipboard
Copied
Hello, @rob day I can understant why you reply is flag as correct answer because your code for the ligne spreads[i].groups.add (spreads.pageItems); return "Invalid value for parameter 'groupItems' of methode 'add'. Expected Array of PageItems, but received nothing." ? 🙂
Hello @Eugene Tyson
By pages I mean :
All items of page 1 grouped as a single group
All items of page 2 grouped as a single group
All items of page 3 grouped as a single group
... One page, One group of all item in the page.
In fact my problem is that I have to move all items on odd pages by 3mm to the left, and all items on even pages by 3mm to the right. So to make it easier to do, I'm trying to group the content of each page so that I only have to move one block on each page.
Copy link to clipboard
Copied
I missed a [i]—this should work:
var spreads = app.documents[0].spreads.everyItem().getElements();
for (i = 0; i < spreads.length; i++) {
if (spreads[i].pageItems.length > 1) {
spreads[i].pageItems.everyItem().locked = false;
spreads[i].groups.add (spreads[i].pageItems);
}
}
Copy link to clipboard
Copied
So to make it easier to do, I'm trying to group the content of each page so that I only have to move one block on each page.
Just note that the script will take all the page items and move them onto a single Layer—grouped objects can not have pageitems on different layers
Find more inspiration, events, and resources on the new Adobe Community
Explore Now