Script to change overprintFill of all paragraph styles in document

New Here ,
May 29, 2020 May 29, 2020

Copy link to clipboard

Copied

I'm a bit lost with scripting - got into it a few years ago, but have forgotten most of what I learned. I'm trying to make a script that will turn on the 'overprint fill' setting in the charactor colour panel of all the paragraph styles in my document. This is what I've come up with, but it's not working:

 

var allParagraphStyles = app.activeDocument.paragraphStyles;
for (i=1; i<allParagraphStyles.length; i++)
{
allParagraphStyles[i].overprintFill = true;
}

 

Would be great if someone could fix this for me so it works - presumably it doesn't need to be a very long script.

Thanks

TOPICS
Scripting

Views

525

Likes

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

Adobe Community Professional , May 29, 2020 May 29, 2020
Try this code sample: //////////////////////////////////////// var myDoc = app.documents[0]; applyOverPrint(myDoc); for(var i = 0; i < myDoc.paragraphStyleGroups.length; i++){     applyOverPrint(myDoc.paragraphStyleGroups[i]);     } ////////////////////////////////////////// function applyOverPrint(object){     for(var i = 0; i < object.paragraphStyles.length; i++){         try{             object.paragraphStyles[i].overprintFill = true;             }         catch(e){}         }     } /////////...

Likes

Translate

Translate
Adobe Community Professional ,
May 29, 2020 May 29, 2020

Copy link to clipboard

Copied

Try this code sample:

////////////////////////////////////////

var myDoc = app.documents[0];
applyOverPrint(myDoc);
for(var
i = 0; i < myDoc.paragraphStyleGroups.length; i++){
    applyOverPrint(myDoc.paragraphStyleGroups[i]);
    }
//////////////////////////////////////////
function
applyOverPrint(object){
    for(var
i = 0; i < object.paragraphStyles.length; i++){
        try{
            object.paragraphStyles[i].overprintFill = true;
            }
        catch(
e){}
        }
    }

////////////////////////////////////////

Best

Sunil

Likes

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
New Here ,
May 29, 2020 May 29, 2020

Copy link to clipboard

Copied

That's brilliant, thanks a million Sunil - it works! You've saved me lots of time.

Hope you have a great day.

Cheers

Simon

Likes

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
Adobe Community Professional ,
May 29, 2020 May 29, 2020

Copy link to clipboard

Copied

Hi Simon,

you say: "This is what I've come up with, but it's not working:"

What exactly is not working? Are you facing error messages? Will the value change for some styles and not for others? Do other things happen you did not anticipate?

 

"it's not working" simply is not a sufficient description of your issue.

 

Thanks,
Uwe Laubender

( ACP )

 

// EDITED

Likes

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
New Here ,
May 29, 2020 May 29, 2020

Copy link to clipboard

Copied

LATEST

Ok, thanks, got my answer above, but will keep your feedback in mind for next time.

Cheers

Simon

Likes

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