2 Replies Latest reply on Nov 23, 2010 2:45 PM by IT.Coordinator

    what is the function to change paragraph styles?

    IT.Coordinator

      I'm trying to make a simple script that changes a raw data file that has preset Paragraph style already in the exported data from a HTML calender, and once its copied over into Indesign it changes the already existing paragraph style into a diffrent paragrph style?

       

      is this a simple script, I got no idea what the script function is to make the change of paragraphs.

        • 1. Re: what is the function to change paragraph styles?
          Harbs. Level 6

          Two ways:

           

          1) para.appliedParagraphStyle = myNewStyle;

          2) para.applyParagraphStyle(myNewStyle);

           

          Harbs

          1 person found this helpful
          • 2. Re: what is the function to change paragraph styles?
            IT.Coordinator Level 1

            Would this work? or do I got the wrong function commands?

             

             

             

             

            var myInDesign = app
            var myDocument = app.activeDocument
            var myDocName = myDocument.name

             

            app.findParagraphStyle.caseSensitive = false;
            app.findParagraphStyle.wholeWord = false;
            app.findCharacterStyle.wholeWord = false;
            app.findCharacterStyle.caseSensitive = false;

             

            app.findParagraphStyle.findWhat = "SN.outabout.DAY-Gray";
            app.changeParagraphStyle.changeTo = "SN.Holiday-Day_of_the_week";
            app.documents.item(0).changeParagraphStyle();

             


            app.findParagraphStyle.findWhat = "SN.outabout.DATE";
            app.changeParagraphStyle.changeTo = "SN.Holiday-Month_and_Day";
            app.documents.item(0).changeParagraphStyle();

             


            app.findParagraphStyle.findWhat = "SN.listingsLT";
            app.changeParagraphStyle.changeTo = "SN.Holiday-Paragraph";
            app.documents.item(0).changeParagraphStyle();

             


            app.findCharacterStyle.findWhat = "SN.listingsBOLD";
            app.changeCharacterStyle.changeTo = "SN.Holiday-Title_Paragraph";
            app.documents.item(0).changeCharacterStyle();

             

            //myInCopy = CreateObject("InCopy.Application.CS3")  //Not sure if this would work, just crafting idea's.
            //var myDocument = myInCopy.ActiveDocument
            //var mySelection = myInCopy.Selection.Item(1)
            //var myStory = MySelection.ParentStory
            //var myText = myStory.Paragraphs.Item(1)
            //myStory.CheckOut
            //myText.ApplyParagraphStyle myDocument.ParagraphStyles.Item("zAPPROVED"), True
            //myStory.CheckIn

             

             

            Can I just do this with like a Nested If, then Statement?