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

Select all items with object style "red" and change to style "blue"

Explorer ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

Hello!

I want to select all items with object style "shadow 02" and apply object style "shadow 02".

Is that possible?

Thank you!

TOPICS
Scripting

Views

1.0K

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

Guide , Apr 07, 2018 Apr 07, 2018

Hi,

Of course! … A simplistic code could be:

app.findObjectPreferences = app.changeObjectPreferences = null;

app.findObjectPreferences.appliedObjectStyles = app.activeDocument.objectStyles.item("red");

app.changeObjectPreferences.appliedObjectStyles = app.activeDocument.objectStyles.item("blue");

app.activeDocument.changeObject();

app.findObjectPreferences = app.changeObjectPreferences = null;

Best,

Michel, from FRIdNGE

Votes

Translate

Translate
Community Expert ,
Apr 06, 2018 Apr 06, 2018

Copy link to clipboard

Copied

The heading of the post doesn't match the question itself, but if you want to replace the red style with blue, you could do this without a script by going to the object styles panel and deleting the style in question. Once chosen, an option appears to replace the style with something else, and here the change can be made to the blue style.

Screen Shot 2018-04-07 at 13.00.31.png

Or is there something more involved that is required?

If the answer wasn't in my post, perhaps it might be on my blog at colecandoo!

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 ,
Apr 07, 2018 Apr 07, 2018

Copy link to clipboard

Copied

Thank Colin for or replay.

I'm sorry, I didn't explain myself right.

I know it's possible to change object styles through the object styles panel, but I need to change it through a script.

I have several documents with 120 pages witch I have to change the style of specific items. I was wondering instead of doing it manually, use a script to automate the task.

Is that possible?

Thank you again

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
Guide ,
Apr 07, 2018 Apr 07, 2018

Copy link to clipboard

Copied

Hi,

Of course! … A simplistic code could be:

app.findObjectPreferences = app.changeObjectPreferences = null;

app.findObjectPreferences.appliedObjectStyles = app.activeDocument.objectStyles.item("red");

app.changeObjectPreferences.appliedObjectStyles = app.activeDocument.objectStyles.item("blue");

app.activeDocument.changeObject();

app.findObjectPreferences = app.changeObjectPreferences = null;

Best,

Michel, from FRIdNGE

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 ,
Apr 07, 2018 Apr 07, 2018

Copy link to clipboard

Copied

LATEST

Works perfectly!

Thank you very much Michael!

All the best!

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