1 Reply Latest reply on Dec 15, 2009 9:27 AM by AdobeScripts

    Newbie: Placing images in a text - JS/ID CS4

    BitterSweet55

      Hello,

       

      I'm not very experienced with JavaScript an InDesign so please be patient. I tried my best but somehow I seem to be unable to get this script running the way I want to.

       

      I've got a text which contains several images, or rather: the file-names are given in the text and I want to replace them with the actual pictures.

      I did manage to extract the file-names and wrote the name into a "new File", using a for loop. So it looks like this:

       

                     var _name=_story.paragraphs[i].contents;

                     var _file = new File (_folder + "/img/" + _name +"");

                     _story.paragraphs[i].place(_file);

       

      This replaces the file-name with the image, however, the image now seems to be part of the text, so I can move it a little bit up and down but I cannot even move it to the left or to the right. This might be handy for placing the images exactly where they belong, yet it does disturb me. Especially since I now want to add captions beneath the images. I tried to use the same method for them but now I have two frames at the same place and I cannot move one of them.

      Another problem is that some of the pictures don't fit into the type area. But I cannot move them upwards, because I added an objectStyle, containing text wrap information, but the text is only pushed away in a certain area, so InDesign forces me to place the image exactly at one position, otherwise the page will look very strange. However, I am unable to change this one "good" position.

      I hope you understand what I mean.

       

      My question now is: is there a way to untangle all those frames, to part the picture-frames from the text-frames/the story, so that they can be moved around freely on the paper?

      I liked the way I placed the images, because now I can be assured that all the images are placed where they belong, but I would really like the possibility, to move pictures upwards, if the don't fit into the type area and I still have to add the captions.

       

       

      Thanks for your help

        • 1. Re: Newbie: Placing images in a text - JS/ID CS4
          AdobeScripts Level 3

          My question now is: is there a way to untangle all those frames, to part the picture-frames from the text-frames/the story, so that they can be moved around freely on the paper?

          You need to convert InLine graphics to Anchored graphics - you can do this as local modification or you can apply ObjectStyle.

           

          Property AnchoredObjectSettings As AnchoredObjectSetting
              read-only
              Member of InDesign.Rectangle
              An
          chored object settings.


          Property AnchoredPosition As idAnchorPosition
              Member of InDesign.AnchoredObjectSetting
              The position of the anchored object relative to the anchor.


          Const idAnchored = 1097814113 (&H416F5061)
              Member of InDesign.idAnchorPosition
              Custom anchor position.

           

          robin

           

          www.adobescripts.co.uk