select object by name or by color

Explorer ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

 i have text frame.

i search for script that select text frame by name (name of the object in the layer window), or by color (color of the text fill)

TOPICS
Scripting

Views

134

Likes

translate

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
community guidelines

correct answers 1 Correct Answer

Most Valuable Participant , Dec 14, 2020 Dec 14, 2020
Do you really have named text frames? Or there are only automatically "named" textframes (showing the first part of contents)?   Does that works for you? app.activeDocument.textFrames.getByName("test").selected = true;

Likes

translate

Translate

Translate
Most Valuable Participant ,
Dec 14, 2020 Dec 14, 2020

Copy link to clipboard

Copied

Do you really have named text frames?

Or there are only automatically "named" textframes (showing the first part of contents)?

 

Does that works for you?

app.activeDocument.textFrames.getByName("test").selected = true;

Likes

translate

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
community guidelines
Explorer ,
Dec 15, 2020 Dec 15, 2020

Copy link to clipboard

Copied

yes!!

thanks!

Likes

translate

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
community guidelines
Explorer ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

AND BY Stroke COLOR (magenta)?

Likes

translate

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
community guidelines
Adobe Community Professional ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

This can be more or less efficient if you can specify that for sure, we can rely on the very 1st character of the text to have the stroke on it. If that is the case, we do not have to worry about traversing characters of text in order to know this is the text frame you want.

if so, maybe this will work for you, it selects all ones with 25+ magenta:

#target illustrator
function test () {

	var doc = app.activeDocument;
  var thisFrame;
	for (var i = 0; i < doc.textFrames.length; i++){
		thisFrame = doc.textFrames[i];
	  if (thisFrame.characters[0].strokeColor.magenta > 25) {
	    thisFrame.selected = true;
	  }
	}

};
test();

 

Likes

translate

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
community guidelines
Explorer ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

Hey thanks,
I meant a contour of just a simple square.

Another thing I'm looking for is someone who writes paid scripts.

Likes

translate

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
community guidelines