1 Reply Latest reply on Jun 29, 2009 7:51 AM by [Jongware]

    Select multiple frames in jscript

    Techi Panda Level 2

      Hi Scripters


      I am trying to select two frames one is text frame next one is graphic frame. I need to select both and make them center alignment in javascript.


      anyone advice me how to do this?


      thanks in advance



      a r u l

      Select multiple frames in jscript

        • 1. Re: Select multiple frames in jscript
          [Jongware] Most Valuable Participant

          Usually, you don't have to select items in javascript, you can apply anything you want directly. But if you need it, it's the [item].select ([selectionOptions]) method, available for any graphic object.

          If a is your text frame and b you graphics frame, it comes down to


          a.select (); // SelectionOptions.REPLACE_WITH is the default

          b.select (SelectionOptions.ADD_TO);

          You can set the text alignment of the text frame to centered, but not that of the graphics frame -- it's a text only attribute (to be precise, a Paragraph property). Given the selection above, of a text frame and a rectangle (ID doesn't care if it contains a graphic or not, as long as it does not contain text),


          app.selection[0].paragraphs.everyItem().justification = Justification.CENTER_ALIGN;


          sets the paragraph alignment for the text in frame (a) but -- rather obviously -- not in frame (b).