Back

If your email is not recognized and you believe it should be, please contact us.

  • You must be logged in to reply to this topic.Login

Placing Images to specific place on document.. Javascript Reference?

Return to Member Forum

  • Author
    Posts
    • #62576
      OneActLife
      Member

      Hi All,

      I have been doing some research on if it is possible to import images from a folder and then place them at specific points on the document.

      I have lots of experience with Javascript, and it appears that there are methods to import images from a folder. And people have seemed to place images as well.

      My scenario is that I need to place images in a grid like pattern in columns and rows. Creating a frame of sort of images.

      First I was hoping that this wonderful community could tell me that if this is even possible? And if so, if you could direct me to some good places to start for javascript scripting for indesign, I would be very greatful.

      Thanks!

      Dustin

    • #62579

      Ah, nothin' like tootin' your own horn :)

      To place a new file on an exact location, you must do two things. First, place the new image (https://jongware.mit.edu/idcs5&…..html#place). The return object of “place” is an array, and its first item (#0 for Javascript) will be a handle to the image. However, for the next step, you need to move its frame, just like in the interface itself.

      Try this (warning: typed on my iPad, so from memory):

      img = app.activeDocument.place(new File(“yourfilename”));

      imgFrame = img[0].parent;

      imgFrame.move([“1in”, 1in];

      This will place rhe image and then move it to 1″ off the left top of your page (actually, relative to the ruler origin, whereever that may be — but “top left” is a fairly good bet).

      More information: Adobe's site has a Beginner's Guide for Javascript under the heading “Scripting resources”. Then there is my own Introduction to JS for ID: https://creativepro.com/jav…..ginner.php

      and on the MIT site I referred to above expanded and improved versions of the built-in Javascript Reference for every InDesign version since CS3 or so. All of that ought to keep you occupied for a while!

    • #62581
      OneActLife
      Member

      This info is fantastic, Jongware, Thanks!

Viewing 2 reply threads
  • You must be logged in to reply to this topic.
Forum Ads