Copy link to clipboard
Copied
When i call the method selectObjectsOnActiveArtboard on an artboard, is there a way to easily group all items in the selection?
Like in the menu found under "right click > group"
Try this:
// GroupFromSel.jsx
// regards pixxxelschubser
if ( app.documents.length > 0 && app.activeDocument.selection.length > 0) {
var aDoc = app.activeDocument;
var Sel = aDoc.selection;
var GroupFromSel = aDoc.groupItems.add();
for ( i = Sel.length-1; i >= 0; i--) {
Sel.moveToBeginning( GroupFromSel )
}
}
Have fun
Copy link to clipboard
Copied
Try this:
// GroupFromSel.jsx
// regards pixxxelschubser
if ( app.documents.length > 0 && app.activeDocument.selection.length > 0) {
var aDoc = app.activeDocument;
var Sel = aDoc.selection;
var GroupFromSel = aDoc.groupItems.add();
for ( i = Sel.length-1; i >= 0; i--) {
Sel.moveToBeginning( GroupFromSel )
}
}
Have fun
Copy link to clipboard
Copied
Hi,
How to group "n" numbers of eps files in a folder?
Copy link to clipboard
Copied
Working great, but I have changed moveToBeginning to moveToEnd because the order was not correct
Thanks
Copy link to clipboard
Copied
You're welcome.
abjelly wrote:
… but I have changed moveToBeginning to moveToEnd because the order was not correct …
Strange. Are you sure?
The (last) selected item is moved to the top position.
The (penultimate) selected item is moved to the top position … and so on ...
… the (first) selected item is moved to the top position.
The order should be all right.
Like this:

Find more inspiration, events, and resources on the new Adobe Community
Explore Now