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

Selecting all text elements with given font

Explorer ,
Nov 09, 2022 Nov 09, 2022

Copy link to clipboard

Copied

Hi All,

My question is how to find and select all text elements with the same font in whole document ?

For example I want to find and select all words in Century font on given layer ?

From inside the program or by the script.

 

Thank you,

 

TOPICS
Scripting , Tools

Views

441

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 2 Correct answers

Community Expert , Nov 09, 2022 Nov 09, 2022

Hi, Try following

var temp = app.activeDocument.textFrames.add();
temp.contents = "Temp";
temp.textRange.textFont = app.textFonts.getByName('ArialMT'); // Replace ArialMT with your font name here
app.executeMenuCommand('Find Text Font Family menu item');
temp.remove();

 

This will select all textframes with font ArialMT.

Votes

Translate

Translate
Community Expert , Nov 09, 2022 Nov 09, 2022
quote

From inside the program


By @Beff

 

select one text frame then go to Select->Same->Font Family

Votes

Translate

Translate
Adobe
Community Expert ,
Nov 09, 2022 Nov 09, 2022

Copy link to clipboard

Copied

Hi, Try following

var temp = app.activeDocument.textFrames.add();
temp.contents = "Temp";
temp.textRange.textFont = app.textFonts.getByName('ArialMT'); // Replace ArialMT with your font name here
app.executeMenuCommand('Find Text Font Family menu item');
temp.remove();

 

This will select all textframes with font ArialMT.

Best regards

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
Community Expert ,
Nov 09, 2022 Nov 09, 2022

Copy link to clipboard

Copied

There can be different ways to select the textframe on a given layer. What I am following here is to locked all other layers and then select required textframes and then unlock the locked layers.

var _layerName = 'Layer 1'; // Use your layer name on which you want to select the textframes;
var doc = app.activeDocument;
for (var l = 0; l < doc.layers.length; l++) {
        if (doc.layers[l].name != _layerName) {
                doc.layers[l].locked = true;
        }
}

var temp = doc.layers[_layerName].textFrames.add();
temp.contents = "Temp";
temp.textRange.textFont = app.textFonts.getByName('ArialMT'); // Replace ArialMT with your font name here
app.executeMenuCommand('Find Text Font Family menu item');
temp.remove();

for (var l = 0; l < doc.layers.length; l++) {
        if (doc.layers[l].name != _layerName) {
                doc.layers[l].locked = false;
        }
}

 

Above script need more handling if in case some layers are alreday locked before running the script.

Best regards

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
Community Expert ,
Nov 09, 2022 Nov 09, 2022

Copy link to clipboard

Copied

As @Charu Rajput already wrote in her good answer.

 

But I am afraid that this approach, as good as it may be, is not suitable for you because your question is too general, a more detailed explanation, screenshots and/or example file is completely missing.

 

Please give us more detailed information about the structure of your document, the paragraph and character style used, the layer hierarchy in the document and the hierarchy of elements in the layer. Should only characters or words or sentences or paragraphs or whole text frames be found? What should be done with the elements found (--> think forward)?

 

Your level of knowledge and whether you can write scripts yourself and need a little help or whether you need someone to write a script for you.

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 ,
Nov 10, 2022 Nov 10, 2022

Copy link to clipboard

Copied

OK, so I will give some more info. Usually I insert as little information as possible to not make mess in question and thinking process.

 

The best will be file.

 

It is a map (well, one of many), and you see different text elements. Some connected with waters (blue), some with settlements (black) and so on.

 

I want select only blue (water elements). These are Century fonts.

 

And I doubt it is a text frame, because they are text on paths (?)

 

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
Community Expert ,
Nov 09, 2022 Nov 09, 2022

Copy link to clipboard

Copied

quote

From inside the program


By @Beff

 

select one text frame then go to Select->Same->Font Family

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
Community Expert ,
Nov 10, 2022 Nov 10, 2022

Copy link to clipboard

Copied

Ok. Thank you for the example file.


Most of the (blue) fonts for the rivers are actually type on a path. The way described by @CarlosCanto works for the simultaneous selection of all fonts of the same type. That is why I have not tested the script from @Charu Rajput.

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 ,
Nov 10, 2022 Nov 10, 2022

Copy link to clipboard

Copied

Ahh, AI 2022. So I have old Illustrator (2020). I was wondering what I was missing 🙂

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 ,
Nov 10, 2022 Nov 10, 2022

Copy link to clipboard

Copied

LATEST

EDIT: I see, AI Toolbox.

So it's done.

Thank you all for help 🙂

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