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!
Thanks, I'll try it out. Too bad I can't edit my original post to get rid of the nasty typos. 😉
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.
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?