Skip to main content
Known Participant
August 7, 2020
Answered

How to select non-native artwork with script?

  • August 7, 2020
  • 2 replies
  • 1618 views

How does Illustrator use scripts to select all non-native artwork? Thank you

This topic has been closed for replies.
Correct answer Ton Frederiks

There was a post (which is now a ghost) about it. I believe Carlos Canto made this.

// select non-Native objects
// https://forums.adobe.com/thread/1886524


if (app.documents.length > 0 ) {
var idoc = app.activeDocument;
var NonNativeItemsCount = idoc.nonNativeItems.length;
if (NonNativeItemsCount>0) {
for (i=0; i<NonNativeItemsCount; i++) {
idoc.nonNativeItems[i].selected = true;
}
alert('there are ' + NonNativeItemsCount + ' non-Native items');
}
else
alert('there are no non-Native items');
}

2 replies

Ton Frederiks
Community Expert
Ton FrederiksCommunity ExpertCorrect answer
Community Expert
August 7, 2020

There was a post (which is now a ghost) about it. I believe Carlos Canto made this.

// select non-Native objects
// https://forums.adobe.com/thread/1886524


if (app.documents.length > 0 ) {
var idoc = app.activeDocument;
var NonNativeItemsCount = idoc.nonNativeItems.length;
if (NonNativeItemsCount>0) {
for (i=0; i<NonNativeItemsCount; i++) {
idoc.nonNativeItems[i].selected = true;
}
alert('there are ' + NonNativeItemsCount + ' non-Native items');
}
else
alert('there are no non-Native items');
}

Known Participant
August 8, 2020

thank you for your help

femkeblanco
Legend
August 7, 2020

What type of item is your non-native artwork?  Both placedItems and rasterItems have "selected" properites, which when assigned "true", select the item.