Copy link to clipboard
Copied
In QuarkXPress is was able to remove styles with:
set style sheet of paragraphs of story 1 of current box to null
When I try something similar in InDesign, using:
set applied character style of characters of parent story of myFrame to "[None]"
I get an error saying that "Adobe InDesign CS5.5 got an error: Invalid value for set propery 'applied character style'. Expected character style or string, but received "[None]".
"[None]" is the name of a Character Style Sheet, but for some reason it looks like InDesign doesn't recognize it as such. Does anyone know how to remove the style sheets from placed text?
You need to get the character style [None] of the parent document that contains the story.
Try
set applied character style of parent story of myFrame to character style "[None]" of parent of parent story of myFrame
Copy link to clipboard
Copied
Hi,
This kind of stuff always pissed me off. InDesign expected a String. Guess what ? I gave you a String !!!
Anyway, the None character style is always in index 1 ( 0 in js ) so you may use this as a workaround :
tell application "Adobe InDesign CS5.5"
set find text preferences to nothing
set change text preferences to nothing
set find what of find text preferences to "~"
set change to of change text preferences to " "
tell active document
set myFrame to text frame 2 --use your own reference
name of applied character style of parent story of myFrame
set applied character style of parent story of myFrame to character style 1 -- character style 1 would always point to None.
end tell
end tell
Hope it helps,
Loic
Copy link to clipboard
Copied
That's exactly how I've been feeling – pissed off!
Thanks for the insight on indexes but now I'm getting an error saying that "object is from a different document or workspace" ...
Here's a block of code from the script:
if content type of myFrame is text type then
set x to 1
set paraCount to count of paragraphs of parent story of myFrame
set applied character style of parent story of myFrame to character style 1
set applied paragraph style of every paragraph of parent story of myFrame to "Body text rag right"
repeat until x > paraCount
set wordCount to count words of paragraph x of parent story of myFrame
if wordCount < 3 then
if wordCount = 0 then
delete paragraph x of parent story of myFrame
set paraCount to paraCount - 1
set x to x - 1
else
set applied paragraph style of paragraph x of parent story of myFrame to "Subhead"
end if
end if
set x to x + 1
end repeat
end if
Am I missing something obvious in my syntax?
Copy link to clipboard
Copied
You need to get the character style [None] of the parent document that contains the story.
Try
set applied character style of parent story of myFrame to character style "[None]" of parent of parent story of myFrame
Copy link to clipboard
Copied
That did the trick!
Thanx
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more