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
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){}
}
}
//////////////////////
...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
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
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
Copy link to clipboard
Copied
Ok, thanks, got my answer above, but will keep your feedback in mind for next time.
Cheers
Simon