5 Replies Latest reply on Mar 22, 2009 1:12 PM by (Dmitry1776)

    give line, pls

      help, please, to get refer for inside my selection:

      var myDoc = app.documents.item(0);
      then a make "paste" and:
      var MyFrame = app.selection //.item[0]

      and i got inside pasted/selected frame table, which sould be worked
      ///var myTable = MyFrame.textframes.item[1].paragraphs.item[1] --doesn work

      How to get into my table?
      Many thanks

      a can't find this trough ESTK, besause of permanent suspendig of ESTK immediately after it starts.
        • 1. Re: give line, pls
          [Jongware] Most Valuable Participant
          A table is part of a collection of 'Tables', not items inside a paragraph.
          So, presumably,

          >myTable = MyFrame.textframes.item(0).tables.item(0)

          should work.

          You don't have to 'item' everything,


          should work as well. Also notice the difference between [0] and (0). [0] is the first item in an array (not [1]!), as in tables[0] -- since 'tables' is an array. item, on the other hand, is a function, and its argument should therefore be inbetween parentheses.
          • 2. Re: give line, pls
            Level 1
            If we're talking CS3 or CS4, that looks for the first table inside the first anchored text frame of myFrame. Is that's what's needed?

            What exactly is selected after the paste? Why are you doing the paste after starting the script?

            • 3. Re: give line, pls
              Level 1
              i work in CS3
              what i do:

              1. Copy range of cell from Excell sheet
              2. Paste in new page in pub in any plase
              3. Place text cursor into got table and format table with specifying params
              4. Enlarge frame up to Table boundaries (this is big enough, much more than page boundaries)
              5. last - rotate on 90 degree and ajust this big frame to page boundaries.

              All these items (but #3) i could automate.
              Now i need just to change selection from textframe to inner table (or may be to cell in table).
              • 4. Re: give line, pls
                Level 1
                var myPage = app.activeWindow.activePage;
                var myTF = myPage.textFrames[0];
                var myTable = myTF.tables[0];

                Does this help?

                • 5. Re: give line, pls
                  Level 1
                  Yes! This does work.
                  Thanks for help, Dave.