Mobile app version of vmapp.org
Login or Join
LarsenBagley460

: Apply an action to each item in a selection in turn? If you use an Illustrator action on a selection, it applies it to that selection as a whole. Illustrator actions can be applied as 'batches',

@LarsenBagley460

Posted in: #Actions #AdobeIllustrator

If you use an Illustrator action on a selection, it applies it to that selection as a whole.

Illustrator actions can be applied as 'batches', but this means batches of files, not batches of objects.

Is there a way to apply an action to each object in turn (like Transform Each does), not the whole selection?

10.02% popularity Vote Up Vote Down


Login to follow query

More posts by @LarsenBagley460

2 Comments

Sorted by latest first Latest Oldest Best

 

@Ogunnowo857

This works:

var docSelected = app.activeDocument.selection;
if ( docSelected.length > 0 ) {
var actionName = prompt("Which action do you want to run?", "");
var set = prompt("Which set is your action in?", "Default Actions");
for ( i = 0; i < docSelected.length; i++ ) {
docSelected[i].selected = false;
}
app.activeDocument.selection = null;
for ( i = 0; i < docSelected.length; i++ ) {
docSelected[i].selected = true;
app.doScript(actionName, set)
docSelected[i].selected = false;
app.activeDocument.selection = null;
}
} else {
alert( "Please select one or more art objects" );
}

10% popularity Vote Up Vote Down


 

@Michele215

With scripting yes. Modified the AI scripting docs:

var docSelected = app.activeDocument.selection;
if ( docSelected.length > 0 ) {
if ( docSelected.length > 0 ) {
for ( i = 0; i < docSelected.length; i++ ) {
docSelected[i].selected = false;
//Do Something to docSelected[i]
}
} else {
docSelected.selected = false;
//Do Something to docSelected[i]
}
} else {
alert( "Please select one or more art objects" );
}

10% popularity Vote Up Vote Down


Back to top | Use Dark Theme