Highlighted

How to search / filter objects by name in Layers panel?

Explorer ,
Sep 20, 2018

Copy link to clipboard

Copied

Is there any way exists for filter (via typing substring) list of all document objects in Adobe Illustrator Layers panel? For quick find and select objects with same word in name.

Most Valuable Participant
Correct answer by pixxxelschubser | Most Valuable Participant

Yes, possible with scripting.

Here you go:

// select_byPartOfName.jsx

// does not work with 'automatically' named text frame items

// https://forums.adobe.com/message/10636405#10636405

var aDoc = app.activeDocument;

var pI = aDoc.pageItems;

aDoc.selection = null;

    $.writeln(pI.length)

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

    $.writeln(pI.name.match(/test/i))

    if (pI.name.match(/test/i) != null) {

        pI.selected = true;

        }

    }

select_byPartOfName.png

TOPICS
Scripting

Views

1.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

How to search / filter objects by name in Layers panel?

Explorer ,
Sep 20, 2018

Copy link to clipboard

Copied

Is there any way exists for filter (via typing substring) list of all document objects in Adobe Illustrator Layers panel? For quick find and select objects with same word in name.

Most Valuable Participant
Correct answer by pixxxelschubser | Most Valuable Participant

Yes, possible with scripting.

Here you go:

// select_byPartOfName.jsx

// does not work with 'automatically' named text frame items

// https://forums.adobe.com/message/10636405#10636405

var aDoc = app.activeDocument;

var pI = aDoc.pageItems;

aDoc.selection = null;

    $.writeln(pI.length)

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

    $.writeln(pI.name.match(/test/i))

    if (pI.name.match(/test/i) != null) {

        pI.selected = true;

        }

    }

select_byPartOfName.png

TOPICS
Scripting

Views

1.8K

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Sep 20, 2018 0
Adobe Community Professional ,
Sep 22, 2018

Copy link to clipboard

Copied

As far as I can tell, the only way to accomplish this would be with a script. I did find one online, but it seems to be a work in progress. I'm not a scripting expert, but perhaps someone on this forum would be more adept in writing something like that. I'd find it helpful, as well!

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 22, 2018 1
Most Valuable Participant ,
Sep 23, 2018

Copy link to clipboard

Copied

Yes, possible with scripting.

Here you go:

// select_byPartOfName.jsx

// does not work with 'automatically' named text frame items

// https://forums.adobe.com/message/10636405#10636405

var aDoc = app.activeDocument;

var pI = aDoc.pageItems;

aDoc.selection = null;

    $.writeln(pI.length)

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

    $.writeln(pI.name.match(/test/i))

    if (pI.name.match(/test/i) != null) {

        pI.selected = true;

        }

    }

select_byPartOfName.png

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 23, 2018 2
Explorer ,
Oct 16, 2018

Copy link to clipboard

Copied

Thanks for so short but very useful script! Will be good to have build-in object filter in Adobe Illustrator interface, for example in bottom line of Objects panel.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 16, 2018 0
Adobe Community Professional ,
Oct 17, 2018

Copy link to clipboard

Copied

agree, it would be great to be able to customize the UI but it is not possible at the moment.

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Oct 17, 2018 1
Explorer ,
Jan 20, 2019

Copy link to clipboard

Copied

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jan 20, 2019 1
Explorer ,
Jun 04, 2020

Copy link to clipboard

Copied

Can someone explain step-by-step to a scripting newbie how to use this? I was able to make the script file have it appear in the scripts file, but when I select it I get an error:

Error 1302: No such element / $.writeln(pI.name.match(/test/i))

So obviously I'm not using it right. It looks like the key is with the "test" in the code, but I don't really understand if this is a string or a variable or what. I tried changing "test" to a word that appeared in some layer names, but I still got that error (with the new string substituted for "test").
Can someone offer help here?

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 04, 2020 0
Most Valuable Participant ,
Jun 05, 2020

Copy link to clipboard

Copied

You are right.

 

It is a known bug. The change to the new forum software removed parts of code ( mostly the counter "i" )

 

Try this version:

// select_byPartOfName.jsx
// does not work with 'automatically' named text frame items
// https://forums.adobe.com/message/10636405#10636405

var aDoc = app.activeDocument;
var pI = aDoc.pageItems;
aDoc.selection = null;
for (i=pI.length-1; i>=0; i--) {
	if (pI[i].name.match(/test/i) != null) {
		pI[i].selected = true;
		}
	}

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Jun 05, 2020 1
Adobe Employee ,
Sep 24, 2018

Copy link to clipboard

Copied

moved to Illustrator Scripting

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Sep 24, 2018 0