Highlighted

Script to change overprintFill of all paragraph styles in document

New Here ,
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

Adobe Community Professional
Correct answer by Sunil Yadav | Adobe Community Professional

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

TOPICS
Scripting

Views

445

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

Script to change overprintFill of all paragraph styles in document

New Here ,
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

Adobe Community Professional
Correct answer by Sunil Yadav | Adobe Community Professional

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

TOPICS
Scripting

Views

446

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
May 29, 2020 0
Adobe Community Professional ,
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
Reply
Loading...
May 29, 2020 0
New Here ,
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
Reply
Loading...
May 29, 2020 0
Adobe Community Professional ,
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
Reply
Loading...
May 29, 2020 0
simonvg LATEST
New Here ,
May 29, 2020

Copy link to clipboard

Copied

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
Reply
Loading...
May 29, 2020 0