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

Change Object Style with Script

New Here ,
May 23, 2018 May 23, 2018

I have a bunch of templates that have an applied object style and i need to change the stroke attribute from 1pt black to [None]. How can i achieve this with a script?

image002.png

TOPICS
Scripting
1.2K
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

Participant , May 24, 2018 May 24, 2018

Wouldn't it make more sense to change it from 1pt to 0pt?

I don't know if this will help you, but the script below will remove/make the stroke on all items, on all pages to 0pt:

var doc = app.activeDocument;

for(var i = 0; i < doc.pages.length; i++) {

    doc.pages.item(i).pageItems.everyItem().strokeWeight = 0;

}

EDIT: You could also target the Object Style directly, I think that is what you are really looking for, see below:

var doc = app.activeDocument;

for(var i = 0; i < doc.pages.length; i++) {

   

...
Translate
Participant ,
May 24, 2018 May 24, 2018

Wouldn't it make more sense to change it from 1pt to 0pt?

I don't know if this will help you, but the script below will remove/make the stroke on all items, on all pages to 0pt:

var doc = app.activeDocument;

for(var i = 0; i < doc.pages.length; i++) {

    doc.pages.item(i).pageItems.everyItem().strokeWeight = 0;

}

EDIT: You could also target the Object Style directly, I think that is what you are really looking for, see below:

var doc = app.activeDocument;

for(var i = 0; i < doc.pages.length; i++) {

    doc.objectStyles.itemByName("myObjectStyle").strokeColor = "None";

}

Hope this points you in the right direction.

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
New Here ,
May 24, 2018 May 24, 2018
LATEST

Thank you. Thats what i was looking for.

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