4 Replies Latest reply on Apr 27, 2009 11:02 AM by secondgradersrule

    Can't apply paragraph styles outside of main list [CS4 Javascript]

    secondgradersrule

      I have a script that goes through a document, line by line, and applies paragraph styles based on each line's contents.

       

      This syntax works for a style defined in the main group of paragraph styles:

      app.activeDocument.stories[0].lines[iLoop].appliedParagraphStyle= "AGPPBold";    

       

      I have a separate folder (xSports) for other styles, including "AGPPRegular."  Various attempts to reference this style have generated script errors.

      Examples:

       

      app.activeDocument.stories[0].lines[iLoop].appliedParagraphStyle = "xSports\\:AGPPRegular";   

      app.activeDocument.stories[0].lines[iLoop].appliedParagraphStyle = "\\xSports\\:AGPPRegular";  

      app.activeDocument.stories[0].lines[iLoop].appliedParagraphStyle = "xSports:AGPPRegular";   

      app.activeDocument.stories[0].lines[iLoop].appliedParagraphStyle = "xSports:\AGPPRegular";      (Javascript eats the single slash)

       

      I manually assigned this style to a line and exported the file as tagged text.  Here is what InCopy produced:

       

      <ParaStyle:xSports\:AGPPRegular>9 Kilrane (P. Hernandez Ortega) xx111 10-1\<

       

      So I am stumped.  What is the correct syntax?  Any help will be appreciated.

       

      Dick Conrad