hi all
any one know small script for find and replace in selected story in indesign file?
I have one file with multi stories… and I have script find and replace but when I run it all the stories changed. I need to change the active story only …
who can help me?
alsadr
Hi alsadr,
Here’s an example:
set t to "You talk when you cease to be at peace with your thoughts;
And when you can no longer dwell in the solitude of your heart you live in your
lips, and sound is a diversion and a pastime.
And in much of your talking, thinking is half murdered.
For thought is a bird of space, that in a cage of words may indeed unfold its wings
but cannot fly.
There are those among you who seek the talkative through fear of being alone.
The silence of aloneness reveals to their eyes their naked selves and they would
escape.
And there are those who talk, and without knowledge or forethought reveal a
truth which they themselves do not understand.
(Page 38)."
--
ReplaceText(t, "talk", "Speak")
on ReplaceText(t, s, r)
set tids to AppleScript's text item delimiters
set AppleScript's text item delimiters to s
set temp_list to text items of t
set AppleScript's text item delimiters to r
set new_text to temp_list as string
return new_text
end ReplaceText
gl,
You need to set target of the command, something like:
tell application id "com.adobe.InDesign" -- Adobe InDesign CS6.app
if class of selection is text frame then
find text parent story of selection
else
try
find text parent of selection
on error
-- handle the fact that selection is not a frame or text
end try
end if
end tell