Skip to main content
Inspiring
July 30, 2014
Answered

Can I execute a menu command in illustrator CS5 using extendscript

  • July 30, 2014
  • 1 reply
  • 937 views

I've seen it in Indesign but can't seem to get it to work in illustrator. If not could anyone tell me how I would group all items together on a layer run a function then ungroup them again. I'm fairlt new to this and struggle with the documentation

Thanks

Bob

This topic has been closed for replies.
Correct answer pixxxelschubser

Hi Bob,

It's been a bit more difficult.


(And there are already some handful Illustrator Scipters all over the world.)


For the beginning you can try something like this:

// https://forums.adobe.com/thread/1535178

// MoveSimpleArtwork2NewGroup.jsx

// regards pixxxelschubser

var aDoc = app.activeDocument;

aDoc.selectObjectsOnActiveArtboard();

var sel = aDoc.selection;

var newGroup = aDoc.groupItems.add();

for (i=sel.length-1; i>=0; i--) {

    sel.moveToEnd(newGroup);

    }

alert("done");

Have fun

1 reply

CarlosCanto
Community Expert
Community Expert
July 30, 2014

no, executing menu commands if only possible with CS6 or newer.

to group

- create a group

- move objects into the group

to ungroup

- move objects out of the group

- remove the empty group

Inspiring
July 30, 2014

One again Carlos, thanks for the help. You seem to be the only illustrator scriptor on the planet

So something like this?

    var chart=PageItems(layer.hasSelectedArtwork = true)

    var groupChart=layer.groupItems.add();

    chart.move (groupChart)

pixxxelschubser
Community Expert
pixxxelschubserCommunity ExpertCorrect answer
Community Expert
July 30, 2014

Hi Bob,

It's been a bit more difficult.


(And there are already some handful Illustrator Scipters all over the world.)


For the beginning you can try something like this:

// https://forums.adobe.com/thread/1535178

// MoveSimpleArtwork2NewGroup.jsx

// regards pixxxelschubser

var aDoc = app.activeDocument;

aDoc.selectObjectsOnActiveArtboard();

var sel = aDoc.selection;

var newGroup = aDoc.groupItems.add();

for (i=sel.length-1; i>=0; i--) {

    sel.moveToEnd(newGroup);

    }

alert("done");

Have fun