5 Replies Latest reply on Mar 7, 2016 4:01 AM by Peter Kahrel

Hey!

I am making a book of 463 pages. For each page the image/imageframe has to become slightly bigger. To be exact the frame needs to expand 0,1835 mm upwards and downwards per page. This needs to me executed very exact. Due to both need of precision and wanting to save time, I want to find some kind of algorithm to do this. I have not found any tutorials on this. Anybody knows of a good method?

THANKS!

• ###### 1. Re: gradually expanding frame

Assuming that each page contains just one frame with an image, this code expands each frame by 0.1835mm vertically:

```pages = app.activeDocument.pages.everyItem().getElements();
for (i = 0; i < pages.length; i++) {
image = pages[i].rectangles[0];
gb = image.geometricBounds;
gb[0] -= i * 0.1835;
gb[2] += i * 0.1835;
image.geometricBounds = gb;
}
```

Make sure your document's measurement units are millimeters and run the script. The idea is this: every page item has geometric bounds, which is an array of values: top, left, bottom, right -- in that order. On every page, make the top value smaller and the bottom value bigger and apply the bounds to the frame on the page.

Peter

• ###### 2. Re: gradually expanding frame

Thanks!

Im a student and embarrassingly new in this. Can i download this script or should i write it myself?

• ###### 3. Re: gradually expanding frame

Copy the code and paste it into a text editor. Save the file as a plain text file with the extension .jsx in your scripts folder. To find that folder, open the Scripts panel in InDesign (Window > Utilities > Scripts), right-click the User folder, and select 'Reveal in Finder/Explorer'.

• ###### 4. Re: gradually expanding frame

Thanks!
im working on it and it seems at least to be going in some kind of right direction. Only one last thing,I can't really figure out if I should run the script per page, or just once for the entire file.

THANK you!

• ###### 5. Re: gradually expanding frame

Once for the entire file.