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

Automating place images

Return to Member Forum

  • Author
    Posts
    • #64298
      Anonymous
      Inactive

      Hello everybody, i'm looking for a script that could automate my workflow. I have lots of .indd files created by data merge, but my problem is I can't import all images because it doesn't have a pattern on amount of links..

      For example:

      802004020.indd

      Links = 802004020-0002-01.tif, 802004020-0080-01.tif, 802004020-1000-01.tif

      802004133.indd

      Links = 802004133-1024-01.tif, 802004133-4541-01.tif, 802004133-5664-01.tif, 802004133-4500-02.tif

      I thought in a script that works in this way: I select a frame text (802004020) e.g. and the script places all images starting with 802004020 in a specific folder. Is it possible?

      Thank you all..

    • #64301

      I thought in a script that works in this way: I select a frame text (802004020) e.g. and the script places all images starting with 802004020 in a specific folder. Is it possible?

      It sure is possible. If I understand correctly, you don't even have to select a text first — this would be the InDesign file name, right? Then you can use

      var imageRootName = app.activeDocument.fullName.name.match(/^.+(?=.indd$)/i);

      Gathering image file names from a specific folder is as easy as this:

      var specificFolder = Folder('/c/temp');

      var imageList = specificFolder.getFiles(imageRootName+'*');

      alert (imageList.join('r'));

      Despite its name, the 'getFiles' function can return both files and folders. If there is a chance your file name specification might also match a folder, you can inspect each of the returned File objects like this:

      if (imageList[i] instanceof File)

      .. yes, safe to place

      Is this enough to get you started?

Viewing 1 reply thread
  • You must be logged in to reply to this topic.
Forum Ads