Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Applescript: Create Grep Style in a Paragraph style

Return to Member Forum

  • Author
    Posts
    • #63028
      lowjackson
      Member

      Hi All

      I'm using the following script to create a grep style within a paragraph style.

      However, the I can't get it to apply my character style? I'm using the applied character style:”GREP_No Break-Text” but no luck!

      Here's the script:

      tell application “Adobe InDesign CS6”

      activate

      tell active document

      — MAKE SWATCHES ************************************************************************************

      — make “**No Break-Text**” swatch

      try

      set myColourSwatch to swatch “**No Break-Text**”

      on error

      make new color with properties {model:process, space:CMYK, color value:{0, 100, 0, 0}, name:”**No Break-Text**”}

      end try

      — MAKE CHARACTER STYLES ************************************************************************************

      –no style by that name already exists.

      try

      set myCharacterStyle to character style “GREP_No Break-Text”

      on error

      –The style did not exist, so create it.

      set myCharacterStyle to make character style with properties {name:”GREP_No Break-Text”}

      end try

      –At this point, the variable myCharacterStyle contains a reference to a character

      –style object, which you can now use to specify formatting.

      set no break of myCharacterStyle to true

      set fill color of myCharacterStyle to “**No Break-Text**”

      — MAKE PARA STYLES ************************************************************************************

      –no style by that name already exists.

      try

      set myParagraphStyle to paragraph style “Body – Master”

      on error

      –The style did not exist, so create it.

      set myParagraphStyle to make paragraph style with properties {name:”Body – Master”}

      end try

      tell paragraph style “Body – Master”

      make new nested grep style with properties {grep expression:”GREP EXPRESSION HERE”} — this works

      –make new nested grep style with properties {grep expression:”GREP EXPRESSION HERE”, applied character style:”GREP_No Break-Text”} — This dosen't work

      end tell

      end tell

      end tell

      Thanks

      Shane

Viewing 0 reply threads
  • You must be logged in to reply to this topic.
Forum Ads