1 Reply Latest reply on Mar 26, 2013 11:47 AM by JeffLambert

    [AS CS6] paragraph content replace

    JeffLambert Level 1

      Hi,

       

      Inspired by an old script found in InDesign magazine for replacing table data, from a document to another and keeping the paragraph styles of the receiving document, I'm now trying to do the same thing but with multiple paragraphs. I know that you can copy and paste without formating from one document to another and this will keep the style. I'm trying to do the same thing but on multiple paragraphs selection that are not the same Paragraph styles. The following script does the samething then copying and pasting without formating on a multiple paragraphs selection.

       

      tell application "Adobe InDesign CS6"

                if not (exists document 2) then

        beep

        activate

                          display dialog "This script requires two documents open, with equivalent table areas selected." buttons {"OK"}

                          return

                end if

       

                set ParaCount1 to count of paragraphs of selection of document 1

                set ParaCount2 to count of paragraphs of selection of document 2

                if (ParaCount1 is not equal to ParaCount2) then

        beep

        activate

                          display dialog "The number of paragraphs don't match." buttons {"OK"}

                          return

       

                end if

       

                set contents of selection of document 2 to contents of selection of document 1

       

      end tell

       

      I've tried a couple of thing with repeating loops but I can't figure out out how to loop in two documents at the same time and having the item from document 1 a replace the coresponding item in document 2.

       

      Anybody as done this before? Any pointers?

       

      I'd like to have:

       

      Contents of paragraph 1 of document 1 to contents of paragraph 1 of document 2

      Contents of paragraph 2 of document 1 to contents of paragraph 2 of document 2

      Contents of paragraph 3 of document 1 to contents of paragraph 3 of document 2

       

      TIA

      Jeff