4 Replies Latest reply on May 31, 2011 12:30 AM by das_kaese

    Adobe InDesign CS5 Server JavaScript: Get rectangle by XML tag





      Current set-up:

      Adobe InDesign Server CS5 scripted through ExtendScript via PHP SOAP


      The problem:

      I'm currently placing an image file into a rectangle using the following code:


       frame     =   doc.rectangles[0];
      =   frame.place(new File(img));

      This works fine; the img file is placed into the rectangle as expected. However, this only refers to the first rectangle in the document: if I have two rectangles in the document, the image is placed into the last created rectangle.


      What I'd ideally like to be able to refer to the rectangle by its XML tag - something like:


      frame     =   doc.getRectangleByTag('Pic'); // <Pic> being the name of the XML tag
      =   frame.place(new File(img));

      Does anyone have any advice as to how this can be achieved? I realise this is rudimentary question, but am finding no joy after several hours of searching.


      Many thanks