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
Copy link to clipboard
Copied
make new nested grep style with properties {grep expression:"GREP EXPRESSION HERE", applied character style:myCharacterStyle} should work