• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

Applescript: Create Grep Style in a Paragraph style

New Here ,
Sep 01, 2012 Sep 01, 2012

Copy link to clipboard

Copied

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 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

TOPICS
Scripting

Views

1.2K

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
Enthusiast ,
Sep 01, 2012 Sep 01, 2012

Copy link to clipboard

Copied

LATEST

make new nested grep style with properties {grep expression:"GREP EXPRESSION HERE", applied character style:myCharacterStyle} should work

Votes

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