• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
1

Automatically placing Images(18) from a file into frames (18).

Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Hi I want to automate placing images manually into selected frames.

There is 18 different frames (6) large, (6) medium, (6) small. 

Currently I have to manually place the images in these frames from a selected file. 

Is there a script or feature that allows me to automate this workflow? 

Attached below are images of the template before and after images are placed. 

 

Before.pngAfter.png

TOPICS
How to , Import and export , Scripting

Views

1.0K

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Expert , Nov 15, 2022 Nov 15, 2022

Assuming they are always the same aspect ratio and you have autofitting configured in your template, and placement location doesn't matter, then this should work: 

 

var afs = File.openDialog("Choose all the photos", "*", true);
try { var doc = app.activeDocument; } catch(e) { exit(); } 
var apis = doc.allPageItems;
var n = apis.length;
var i = 0;
if (n !== afs.length) { alert("Number of files selected doesn't match rectangles on page. Placing as much as we can."); }
for (i; i < n; i++) {
    tr
...

Votes

Translate

Translate
Community Expert ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

I can't help with scripting, though likely someone else can, but do you know you can load all 18 files at one, and then just drop them into the frames, as a regular InDesign feature?

 

~Barb

2022-11-15_19-01-59 (1).gif

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Hi Barb Thanks for the reply. 

Yes I know about this feature however I want to automate the process of placing in the images one by one. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Hmmh?

The placement of the 18 images is done with the Place Gun in frames with the automatic adjustment option with 18 clicks in a few seconds. The development of a customised script, on the other hand, could take several hours.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Correct, however I'm processing upwards to 10 of these files a day and expecting more. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

@pixxxelschubser You are referring to the action barb posted above correct?

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

That is correct.

 

But maybe I'm wrong and misjudge the time required for script creation (I actually script mainly for Illustrator and therefore I'm not the right person for you 😉 ). So let's just wait and see what the InDesign scripters have to say.

 

If you need to do it quickly, you can always hire a scripter.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Assuming they are always the same aspect ratio and you have autofitting configured in your template, and placement location doesn't matter, then this should work: 

 

var afs = File.openDialog("Choose all the photos", "*", true);
try { var doc = app.activeDocument; } catch(e) { exit(); } 
var apis = doc.allPageItems;
var n = apis.length;
var i = 0;
if (n !== afs.length) { alert("Number of files selected doesn't match rectangles on page. Placing as much as we can."); }
for (i; i < n; i++) {
    try { 
        apis[i].place(afs[i]);
    } catch(e) {}
}

 

 

 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Hello Brian thanks for the reply and script.

I'm getting an error running the script. I'm sure its something super simple but I have no Javascript experience. 

Script Error.png

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Error was a mistake on my end.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

LATEST

I had inserted an extra bracket that I removed on edit after I spotted it. Glad you got it working. 

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Nov 15, 2022 Nov 15, 2022

Copy link to clipboard

Copied

Brian's Code works! Thanks appreciate the reply.

Votes

Translate

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines