• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

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

483

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

Community Expert , 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;

Votes

Translate

Translate
Adobe
Community Expert ,
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;

Votes

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!

Votes

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)?

Votes

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
Valorous Hero ,
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();

 

Votes

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

LATEST

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

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

Votes

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