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

Edit single shape inside dynamic symbol using javascript

Contributor ,
Oct 24, 2016 Oct 24, 2016

Hello, I have a dynamic symbol.and I want to change the color of one shape. This can be done using direct selection tool. But I need to do with a script. Its urgent. I there any way to do that?? Thanks in advance.

TOPICS
Scripting
697
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
Adobe
Engaged ,
Oct 24, 2016 Oct 24, 2016

The first thought: disassemble a symbol, then change a color of one shape, and then assemble back. Recently, a similar theme I've seen on rudtp.

It seems to me it is not so simple. This requires CS6+. Perhaps in the script will have to load and run the Action.

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
Contributor ,
Oct 24, 2016 Oct 24, 2016

Yes we are using CC version. If you can help more then it will be great help.

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
Valorous Hero ,
Oct 24, 2016 Oct 24, 2016

Hi Marat!

The good news is that as opposed to static symbols, a dynamic symbol's contents can be actually accessed via the color-selection menu commands! If you can know what the starting color is on the target shape within the dynamic symbol, you can use those color-selection commands to achieve your desired goal with ease:

#target illustrator

function test(){

    var doc = app.activeDocument

    doc.defaultFillColor = doc.swatches.getByName("Color_1").color;

    app.executeMenuCommand("Find Fill Color menu item");

    doc.defaultFillColor = doc.swatches.getByName("Color_2").color;

};

test();

Convenient, if you're able to use the starting color.

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
Contributor ,
Oct 25, 2016 Oct 25, 2016

Thanks, this is helpful but does not serve our purpose. It may possible that many parts have same color but we want to change color of single part.

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
Valorous Hero ,
Oct 25, 2016 Oct 25, 2016
LATEST

Okay let's step back- imagine that it's not even a dynamic symbol but a regular group - by which criteria are you wanting to isolate your desired shape? Maybe you can show with screenshot?

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