Copy link to clipboard
Copied
Hi all,
I need help for a script to group all the items (tiff, textframe, ai, pdf...) of every single spread of my .indd documents.
I tried to modify this script (that works only in the active page) with no results:
I read from that you would prefer not to group items on the pasteboard.
So here we go:
var doc = app.documents[0];
var spreadsArray = doc.spreads.everyItem().getElements();
// Unlock all layers and items on all document spreads.
// All masters will be not changed.
doc.layers.everyItem().locked = false ;
doc.spreads.everyItem().pageItems.everyItem().locked = false ;
// Now loop the spreads:
for( var n=0; n<spreadsArray.length; n++ )
{
var allItemsOfCurrentSpreadPagesArray =
spreadsArray[
...
Copy link to clipboard
Copied
Hi,
should be items on the pasteboards be also part of a group?
Regards,
Uwe Laubender
( ACP )
Copy link to clipboard
Copied
Hi,
thanks for the answer.
It's the same. I usually don't leave element in the pasteboard. (thanks to my O.C.D. 😄 )
Copy link to clipboard
Copied
I read from that you would prefer not to group items on the pasteboard.
So here we go:
var doc = app.documents[0];
var spreadsArray = doc.spreads.everyItem().getElements();
// Unlock all layers and items on all document spreads.
// All masters will be not changed.
doc.layers.everyItem().locked = false ;
doc.spreads.everyItem().pageItems.everyItem().locked = false ;
// Now loop the spreads:
for( var n=0; n<spreadsArray.length; n++ )
{
var allItemsOfCurrentSpreadPagesArray =
spreadsArray[n].pages.everyItem().pageItems.everyItem().getElements();
// Do nothing if there is no or only one element on a spread:
if( allItemsOfCurrentSpreadPagesArray.length < 2 ){ continue };
// Finally add a group with all items on the spread.
// NOTE: No items on the pasteboard will be grouped.
spreadsArray[n].groups.add( allItemsOfCurrentSpreadPagesArray );
};
Regards,
Uwe Laubender
( ACP )
// EDITED one comment in the script code:
All > "No items on the pasteboard will be grouped."
The first version unedited also grouped items on the pasteboard, but I changed that to items on pages only.
Copy link to clipboard
Copied
IT WORKS PERFECTLY!
Thank you very much!!!!!