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!
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
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.
Or is there something more involved that is required?
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
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
Copy link to clipboard
Copied
Works perfectly!
Thank you very much Michael!
All the best!