Working in InDesign CS5
Still banging my head against the wall over this last bit of code I need to figure out to finish a much larger script. What I'm looking to do is take a paragraph ('contents' from looping in larger script) from one text frame and duplicate it to the END of a second text frame (represented by 'Ad_Box'). The only thing I've gotten to semi-work is this:
set insertion point -1 of Ad_Box to contents
The problems with the above script are:
1. Minor problem (can be worked around in InDesign CS5) - The script does not keep the formatting from the original paragraph that I want duplicated. The paragraph style of all "inserted" paragraphs is set to default
2. The big problem - When the second text frame is too small for a particular word in original paragraph, the paragraph is moved to the wrong position in the text frame when the script completes, which is moving 4 paragraphs in total (this one baffles me). In other words, if I'm running script to be p1, p2, p3, p4 and p2 had a word too long to fit in text frame, on completion it will look like p1, p3, p4, p2.
This is why I'm hoping to use the DUPLICATE command in some capacity, but I'm stumped. I set up a dialogue prompt to help me debug, and whenever I use the DUPLICATE command my script skips right over the dialogue, so I know it's not reading properly. This is what I've tried with no luck. Any help would be greatly appreciated.
duplicate contents to insertion point -1 of Ad_Box
I think you're on the right track with your first version, but I think you may not be getting the right reference for the insertion point. If you ask for the last insertion point of the text frame, you're getting the last thing that shows in the frame; if you have overset, the insertion point will be before the overset. More likely what you want is the last insertion point of the parent story of that text frame.
Mary, you were absolutely correct!! This fixes the problem of placing the contents into the wrong spot, AND it runs the script much faster too! Thank you.
However it is still not carrying over my "applied paragraph style" that is on "contents". Does 'insertion point' not work this way?
What looks like is happening is that in the InDesign app, whatever my default selected paragraph style is is what the insertion point type is placing as.
I might try to set my applied paragraph style after the "last insertion point" call and see if that works. I'll update this reporting results