I’m wanting to add an “" before every time Italic is used in a story and another "” after the italic ends.
I thought this would be pretty easy, but I’m stumped. Any thoughts?
I’m wanting to add an “" before every time Italic is used in a story and another "” after the italic ends.
I thought this would be pretty easy, but I’m stumped. Any thoughts?
I see that this thread has (mysteriously) been tagged with “InDesign”, however, there is no mention of the application in the original question. Are we discussing ID stories?
Doh! :rolleyes: I didn’t paste all of my question.
Yes, I’m working with an InDesign CS3 story.
In my mind, the simplified workflow would be:
I’m guessing that this involves working with text style ranges, object references, and then insertion points (based on the found text ranges). I’m unclear on how all of these work together. I haven’t found an example in the Scripting Guide that makes it clear to me.
Thanks
I did a lot of trial and error, but was able to get this to work with a loop through the text style ranges:
try
set myTextStyleRanges to (count of text style ranges)
repeat with i from 1 to (myTextStyleRanges) + 1
if font style of text style range i is "Italic" then
set ThisText to text of text style range i
set text of text style range i to ("*" & ThisText & "*")
end if
end repeat
end try
It’s short and works, but is there another (or better) way to do this?
Yes, that works too.
It’s a bit above my head, though. I see that it piggy backs InDesign’s Find/Change feature, but how it executes the Find/Change is greek to me.
I’ve always scripted a find/change within a story by setting every value in the Find/Change menu, then running
tell parent story of item 1 of selection to change text
Could you explain how your solution works?
Thank you