Skip to main content
August 8, 2008
Question

[AS] CS3 Find -Change inserting soft return instead of hard

  • August 8, 2008
  • 2 replies
  • 1106 views
Can anyone help identify why this script doesn't work? i want it to replace multiple returns with a single paragraph return. It's replacing with a soft return rather than a hard return.
I copied and pasted the find grep and change grep fields into the script. I even tried it by typing "\r" into the change grep field. Any thoughts? Much appreciated!

tell application "Adobe InDesign CS3"

--Clear the find/change preferences.
set find grep preferences to nothing
set change grep preferences to nothing
set find text preferences to nothing
set change text preferences to nothing

--Set the find options.
set include footnotes of find change grep options to false
set include hidden layers of find change grep options to false
set include locked layers for find of find change grep options to false
set include locked stories for find of find change grep options to false
set include master pages of find change grep options to false



--delete multiple graphs

set find what of find grep preferences to "~b~b+"
set change to of change grep preferences to "
"
set myStory to parent story of item 1 of selection
tell myStory
set myFoundItems1 to change grep
end tell

set find grep preferences to nothing
set change grep preferences to nothing


end tell
This topic has been closed for replies.

2 replies

August 11, 2008
Shane, thanks! This worked. What I meant to have written was that when copying "~b" from the find/change field in InDesign and pasting into Script Editor, and saving, it converted it automatically to a hard return. I didn't try it manually because sometimes the obvious is elusive! (to me at least)

Thanks again.

Jim
Inspiring
August 8, 2008
You need to use ~b in the replacement field. Your existing version is<br />failing because the default line-end character in Script Editor is now a<br />linefeed, which is the character InDesign uses for a newline.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>