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

Script for automatic image padding

Explorer ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Hey guys,

so, I'm trying to do the following, but can't find any information on where to start:

By default, all our images are supposed to fit their anchored frame proportionally, and have a 0,3cm top padding. So currently, I have to do the following:

1. scroll through the document to find the image

2. left click on the image

3. right click  => fit to frame (proportionally)

4. open object properties

5. set padding (top) to 0,3

6. leftclick the anchored frame

7. Open anchored frame pod

8. set frame height to +0,3 of its original size

 

This is obviously rather tedious, so I'm looking for a way to automate this, but tbh I'm completely lost.  ¯\_(ツ)_/¯ 
Any help would be greatly appreciated, so many thanks in advance!

 

Cheers,

Alex

open 

Views

160

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 ,
Jan 28, 2021 Jan 28, 2021

Copy link to clipboard

Copied

Hi Alex,

 

You might automate some of these tasks with object styles.

https://help.adobe.com/en_US/framemaker/using/index.html#t=using-framemaker%2Fuser-guide%2Ffrm_graph...

 

Best regards

 

Winfried

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
Explorer ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Thanks, I'll try it out. Too bad I can't edit my original post to get rid of the nasty typos. 😉

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
Mentor ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

Hi, this is a bit complicated and requires several scripting skills. You have to know how to obtain graphic and frame IDs, which is sometimes requires more logic than you might think. Then, for a "size-to-fiz", you have to do some math, starting by determining the ratio of the graphic size to the frame size. With that ratio, you have to decide whether the length or the width of the graphic will fit within the frame without the other dimension extending beyond its boundaries. Then you adjust that dimension according to the ratio, record the ratio of change, then apply the second ratio to the other dimension. And then there is the shrinkwrap 🙂

 

It is all possible and I did it with my WS Utilities plugin. And it's really nice stuff to have. But I do not think you will get too much help here, because your request is complicated. This place is better for focused questions about specific problems. You might be asking for too much instruction. I just wanted to mention that if you have trouble getting responses.

 

Russ

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 ,
Jan 29, 2021 Jan 29, 2021

Copy link to clipboard

Copied

LATEST

I agree with Russ, it is best to break things down into specific tasks and try to rough out some pseudo code. I always start with one selected object in my document. For example, here is how to work with the selected anchored frame and its graphic (assuming there is only one graphic per frame).

#target framemaker

var doc, aframe, graphic;

doc = app.ActiveDoc;
aframe = doc.FirstSelectedGraphicInDoc;
graphic = aframe.FirstGraphicInFrame;

// Here is your first challenge:
// What math do you have to perform to 
// figure out the scaling factor to 
// proportionately scale the graphic to the frame?

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