Welcome Dialog

Welcome to the Community!

We have a brand new look! Take a tour with us and explore the latest updates on Adobe Support Community.


Is this code correct

Guest
Jan 21, 2021 Jan 21, 2021

Copy link to clipboard

Copied

var doc = app.activeDocument;
var myPstyle = doc.paragraphStyles.item("PN", "PT", "CN", "CT", "S1", "S1-S2", "S2", "S2-S3", "S3", "S3-S4", "S4")
styleUpdate(myPstyle)
function styleUpdate(myPstyle){
    myPstyle.keepAllLinesTogether = false;
    myPstyle.keepLinesTogether = true;
myPstyle.keepWithPrevious = true;
    myPstyle.keepFirstLines = 2;
    myPstyle.keepLastLines = 2;
myPstyle.startParagraph = StartParagraph.ANYWHERE
 }
TOPICS
Scripting

Views

132

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 , Jan 27, 2021 Jan 27, 2021
Try this : var doc = app.activeDocument; var pStyleNames = ["PN", "PT", "CN", "CT", "S1", "S1-S2", "S2", "S2-S3", "S3", "S3-S4", "S4"]; for(var i = 0; i < pStyleNames.length; i++){ if(doc.paragraphStyles.itemByName(pStyleNames[i]).isValid){ styleUpdate(doc.paragraphStyles.itemByName(pStyleNames[i])); } } //=========================== function styleUpdate(myPstyle){ myPstyle.keepAllLinesTogether = true myPstyle.keepLinesTogether = false; myPstyle.keepFirstLines...

Likes

Translate

Translate
Adobe Community Professional ,
Jan 27, 2021 Jan 27, 2021

Copy link to clipboard

Copied

LATEST

Try this :

var doc = app.activeDocument;
var pStyleNames = ["PN", "PT", "CN", "CT", "S1", "S1-S2", "S2", "S2-S3", "S3", "S3-S4", "S4"];
for(var i = 0; i < pStyleNames.length; i++){
    if(doc.paragraphStyles.itemByName(pStyleNames[i]).isValid){
        styleUpdate(doc.paragraphStyles.itemByName(pStyleNames[i]));
        }
    }
//===========================
function styleUpdate(myPstyle){
    myPstyle.keepAllLinesTogether = true
    myPstyle.keepLinesTogether = false;
    myPstyle.keepFirstLines = 2;  
    myPstyle.keepLastLines = 2;
    myPstyle.keepWithNext = 2;
    myPstyle.startParagraph = StartParagraph.ANYWHERE;
    myPstyle.hyphenation= false;
    }
//===========================

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