Applescript Indesign – make separate text boxes from paragraphs

Hi All

I currently have a single text frame thats contains between 3-6ish separate paragraphs (single line breaks using space after).

I need a script that will make a text frame for each paragraph and then delete the original frame, the new frames can just sit below each other as I’ll need to place these by hand after running the script.

The reason I’m wanting to do this is that I have an annotated image and need to place the text around the image not in a single column to the side.

Any help would be appreciated - applescript preferred so I can learn. I usually have a go at making a start but I’ve never done anything like this before and really don’t know where to start

thanks guys

LJ

Hi. Duplicate the target frame to before it for the paragraph count, minus one. Then remove unnecessary paragraphs. Alternately, make new frames with properties; the unique original paragraphs will be the contents. You won’t have to trim paragraphs with the latter method, but the drawback is that it will discard any text formatting.

Hi thanks for the reply, I managed to do the following.

tell application "Adobe InDesign CC"
	set myParagraphText to {}
	repeat with i from 1 to count the paragraphs of the selection
		set myText to paragraph i of the selection
		set end of myParagraphText to (myText as string)
	end repeat
	set x to 10	
	repeat with i from 1 to count myParagraphText	
		tell active document
			make new text frame with properties {geometric bounds:{x, 10, 80, 50}, contents:(item i of myParagraphText), applied object style:object style "annnotation"}
		end tell
		set x to x + 60
	end repeat
end tell

.however It would only work on a single page document, I couldn’t get it to work on a multi page doc on the current page I was on.

thanks

LJ

If that works for you, the problem is likely the ruler origin in the preferences. It can be set to either page or spread, but you’re also resizing the frame to gargantuan proportions, and I think you may actually want to just move it either to a location or by a preset number.


set increment to 1.5

tell application "Adobe InDesign CC"'s document 1
	set theTarget to selection's item 1
	repeat with counter from 1 to count theTarget's paragraphs
		move (make text frame with properties {geometric bounds:theTarget's geometric bounds, contents:(get theTarget's (paragraph counter)), applied object style:object style "annnotation"}) by {increment, increment}
		set increment to increment + 1.5
	end repeat
end tell

–edited for typo