3 Replies Latest reply on Apr 30, 2008 6:34 AM by (Wayne_A_Palmer)

    import images JavaScript

      Hi Friends,

      I am new fro Javascript. I want to develop one script to import images of folder. I have one indesign document which contains image names like [[test.eps]], [test1.eps]], etc. I have one image folder which contains all the images.

      I want to place these images if available in the folder otherwise show an alert and move to next iteration.

        • 1. Re: import images JavaScript
          Hello Pooja,

          var r = app.activeDocument.pages[0].rectangles.add();
          r.geometricBounds = [---------];
          r.fillColor = colorvalue;
          r.strokeColor = colorvalue;
          r.place (File (path), false);

          Above script will help you to place an image in .indd document.
          I am not getting exactly what you want to do. You want to import all the image in your document or single image.
          If you want to add all the images in your document just make the loop for above script and modify it logically . Hope you will get the answer .

          • 2. Re: import images JavaScript
            Level 1
            Hi Pooja,<br /><br />You could also look at xml to import pictures into a pre defined template. This is what I do for 3000 photos and text and it works quite well. You can manage this by creating a frame for the image and applying a <xmlTag> to it.<br /><br />Use the same tag or every subsequent frame and when you import the xml it will import each in order. The catch is you have to point to every file individually (i.e. pic1.eps, pic2.eps etc.). I get through this issue because all the picture names are stored in a database which creates the xml. The end result though is a fast import that requires no (or very little) javascript.<br /><br />Probably not what you're after but it is another way to skin the cat.<br /><br />Regards,<br />Brett
            • 3. Re: import images JavaScript
              I too am just starting to look at javascript and have the exact same need for a script that will allow me to automate the importation of a large number of images (actually Mathtype EPSs) into an InDesign document. We have placeholders of the form <<eq01.eps>>, <<eq01.eps>>, etc. and currently have to go through the laborious task of importing each equation in one by one. With some documents containing a few hundred equations this can take up quite a bit of my time. All the Mathtype equations reside in a single folder. I know there must be a way to script this function.

              I come from a long history on the mac but my current job is Windows only so Applescript isn't an option.

              Any help in pointing me in the right direction would be greatly appreciated.