2 Replies Latest reply on Mar 1, 2013 10:42 AM by Luke Hodsdon

    [AS] Applescript - Duplicate paragraph from one text frame to end of second text frame?

    Luke Hodsdon

      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