I have a series of paragraphs in a page in InDesign CS5, similar to the following:
Youth Basketball
6/4 - 6/8
9am - 12pm
5 to 12
Registration begins March 5
45
90
Youth Basketball
6/12 - 6/18
9am - 12pm
5 to 12
Registration begins March 5
45
90
I need to move every line that starts with Registration up above the date line. I’ve messed with this all day.
When I run the script I end up with this:
Youth Basketball
Registration begins March 5
Registration begins March 5
Registration begins March 5
Registration begins March 5
Registration begins March 5
6/4 - 6/8
9am - 12pm
5 to 12
Registration begins March 5
45
90
What am I doing wrong, and is there a better way?
[code]tell application “Adobe InDesign CS5.5”
set TheDoc to document 1
set myStory to story 1 of TheDoc
set MoveList to {"Registration"}
tell myStory
set theCount to count every paragraph in myStory
repeat with i from 1 to theCount
if word 1 of paragraph i is in MoveList then
set GetThis to contents of paragraph i
set PutHereText to contents of paragraph (i - 3) of myStory
set NewPara to GetThis & PutHereText as string
tell paragraph (i - 3)
set contents to NewPara
end tell
end if
end repeat
end tell[/code]
Browser: Safari 533.19.4
Operating System: Mac OS X (10.6)