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

Change Text Color in Group

Explorer ,
Jun 24, 2020 Jun 24, 2020

Hi, I have a quick question. I have a group that consists of paths , but one of the objects is a Text and I want the script to do something different with it than the path objects.

I have tried using the following, but it does not work.

var doc = app.activeDocument;

var group = doc.layers["Icon"].groupItems[0];
    for (var i = (group.pageItems.length) - 1; i >= 0; i--) {
        if (group.pageItems[i].typename == "TextFrameItem") {
            group.pageItems[i].textRange.characterAttributes.fillColor = swatch.color;
        }
    }

 

I also tried to delete the layer which did not work.

        var group = doc.layers["Icon"].groupItems[0];
        for (var i = (group.pageItems.length) - 1; i >= 0; i--) {
            if (group.pageItems[i].typename == "TextFrameItem") {
                group.pageItems[i].remove();
            }
        }

 

TOPICS
Scripting
403
Translate
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 , Jun 24, 2020 Jun 24, 2020

Try changing TextFrameItem to TextFrame

 

-Manan

Translate
Adobe
Community Expert ,
Jun 24, 2020 Jun 24, 2020

Try changing TextFrameItem to TextFrame

 

-Manan

Translate
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 ,
Jun 24, 2020 Jun 24, 2020
LATEST

It worked, thank you 😄

Translate
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