3 Replies Latest reply: May 26, 2012 7:09 AM by Olivier.Berquin RSS

    [AS-CS5] Copy contents of a cell, paste into another

    Olivier.Berquin

      Hello everyone,

       

      I would like to copy the contents of a cell (which is an anchored object) and paste it to several other cells via AppleScript.

      I have no idea where to start.

       

      I have to create an array of several hundred row. The first cell of odd (odd cell?) row must contain the anchored object.

       

      Thank you

       

      Oli.

        • 1. Re: [AS-CS5] Copy contents of a cell, paste into another
          sstanleyau Community Member

          This assumes no header or footer rows, but it should get you started:

           

          tell application id "com.adobe.InDesign"

                    tell table 1 of selection

                              set rowCount to body row count

                              repeat with i from 2 to rowCount

                                        duplicate text 1 of cell 1 of row 1 to end of text 1 of cell 1 of row i

                                        contents of cell 1 of row i

                              end repeat

                    end tell

          end tell


          • 2. Re: [AS-CS5] Copy contents of a cell, paste into another
            Olivier.Berquin Community Member

            Thanks Shane.

             

            I'll try this code this afternoon.

             

            Best Regards.

             

            Oli.

            • 3. Re: [AS-CS5] Copy contents of a cell, paste into another
              Olivier.Berquin Community Member

              Works fine. Thanks again!

               

               

              tell application "Adobe InDesign CS5.5"

                   set myBlue to swatch "Blue 100-58-0-21" of document 1

               

                   set myTable to parent of item 1 of selection

                   set rowCount to count of row of myTable

               

                    tell myTable

                        repeat with i from 3 to rowCount by 2

                             tell row i

                                  set height to 2.7

                                  set auto grow to false

                                  set inner column stroke color to myBlue

                                  set vertical justification to bottom align

                                  set inner column stroke weight to 0.5

                             end tell

               

                             duplicate text 1 of cell 1 of row 1 to end of text 1 of cell 1 of row i

                        end repeat

               

                        repeat with i from 2 to rowCount by 2

                             tell row i

                                  set height to 15

                                  set auto grow to true

                                  set inner column stroke color to myBlue

                                  set inner column stroke weight to 0.5

               

                                  set vertical justification to center align

                                  set bottom inset to 3

                                  set top inset to 2

                             end tell

                        end repeat

                   end tell

              end tell