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

Script to add a gray border around placed images?

Explorer ,
Jun 10, 2022 Jun 10, 2022

I've placed 160 images in an InDesign file. Each is centered within a same-sized frame. I'd like to create a script that fits the frame to the image and draws a .75 pt gray border around it. How can I do this? I've hunted for a similar script I could modify, but so far no luck, and I'm not familiar with the InDesign scripting language.

 

Thanks!

TOPICS
How to , Scripting
405
Translate
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 , Jun 10, 2022 Jun 10, 2022

Instead of a script create an object style and apply it. Object styles can exactly do that.

Translate
Community Expert ,
Jun 10, 2022 Jun 10, 2022

Instead of a script create an object style and apply it. Object styles can exactly do that.

Translate
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
Explorer ,
Jun 10, 2022 Jun 10, 2022

Thanks. I hadn't known about object style. I just created one with a border as I described and can quickly apply it to the frame. That gets me halfway there. Is there a way within the object style to also fit the fram to the image? In my ancient version of InDesign, CS6, that doesn't appear to be a fitting option.

Translate
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
Advisor ,
Jun 12, 2022 Jun 12, 2022

Hello @DavidOfMA,

Use this script to complete your task...

app.activeDocument.rectangles.everyItem().fit(FitOptions.FRAME_TO_CONTENT);

 

Regards,

Mike

Translate
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
Explorer ,
Jun 12, 2022 Jun 12, 2022

Thanks. I have other frames in this file that I don't want to fit frame to content, so I ended up doing it manually. Still helpful to learn about object styles, though.

Translate
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 ,
Jun 13, 2022 Jun 13, 2022
LATEST

FYI, CS6 does have these options in object styles:

PeterKahrel_0-1655110105607.pngexpand image

 

Translate
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